mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Fixed possible crash when pausing a torrent
This commit is contained in:
parent
f61d9d23f5
commit
2694a0947f
2 changed files with 7 additions and 1 deletions
|
@ -1116,6 +1116,13 @@ void bittorrent::readAlerts() {
|
||||||
qDebug("Received finished alert for %s", h.name().toUtf8().data());
|
qDebug("Received finished alert for %s", h.name().toUtf8().data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a.get())) {
|
||||||
|
QTorrentHandle h(p->handle);
|
||||||
|
if(h.is_valid()){
|
||||||
|
h.save_resume_data();
|
||||||
|
qDebug("Received paused alert for %s", h.name().toUtf8().data());
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (save_resume_data_alert* p = dynamic_cast<save_resume_data_alert*>(a.get())) {
|
else if (save_resume_data_alert* p = dynamic_cast<save_resume_data_alert*>(a.get())) {
|
||||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||||
QTorrentHandle h(p->handle);
|
QTorrentHandle h(p->handle);
|
||||||
|
|
|
@ -319,7 +319,6 @@ void QTorrentHandle::pause() {
|
||||||
Q_ASSERT(h.is_valid());
|
Q_ASSERT(h.is_valid());
|
||||||
h.auto_managed(false);
|
h.auto_managed(false);
|
||||||
h.pause();
|
h.pause();
|
||||||
h.save_resume_data();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTorrentHandle::resume() {
|
void QTorrentHandle::resume() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue