Browse Source

- Fix a possible crash when pausing then deleting a torrent quickly

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
2556346dda
  1. 4
      src/bittorrent.cpp

4
src/bittorrent.cpp

@ -1264,6 +1264,7 @@ void bittorrent::readAlerts() { @@ -1264,6 +1264,7 @@ void bittorrent::readAlerts() {
else if (save_resume_data_alert* p = dynamic_cast<save_resume_data_alert*>(a.get())) {
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
QTorrentHandle h(p->handle);
if(h.is_valid()) {
QString file = h.hash()+".fastresume";
// Delete old fastresume file if necessary
if(QFile::exists(file))
@ -1276,6 +1277,7 @@ void bittorrent::readAlerts() { @@ -1276,6 +1277,7 @@ void bittorrent::readAlerts() {
bencode(std::ostream_iterator<char>(out), *p->resume_data);
}
}
}
else if (metadata_received_alert* p = dynamic_cast<metadata_received_alert*>(a.get())) {
QTorrentHandle h(p->handle);
if(h.is_valid()) {
@ -1290,11 +1292,13 @@ void bittorrent::readAlerts() { @@ -1290,11 +1292,13 @@ void bittorrent::readAlerts() {
}
else if (file_error_alert* p = dynamic_cast<file_error_alert*>(a.get())) {
QTorrentHandle h(p->handle);
if(h.is_valid()) {
h.auto_managed(false);
std::cerr << "File Error: " << p->message().c_str() << std::endl;
if(h.is_valid())
emit fullDiskError(h, misc::toQString(p->message()));
}
}
else if (dynamic_cast<listen_failed_alert*>(a.get())) {
// Level: fatal
addConsoleMessage(tr("Couldn't listen on any of the given ports."), QString::fromUtf8("red"));

Loading…
Cancel
Save