mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-28 10:48:19 +03:00
Prevent crash due to race condition when adding magnet link
PR #19792. Closes #19780. Closes #19790.
This commit is contained in:
parent
4b56bdd36f
commit
42d7465cba
1 changed files with 6 additions and 1 deletions
|
@ -2435,6 +2435,11 @@ bool SessionImpl::cancelDownloadMetadata(const TorrentID &id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const lt::torrent_handle nativeHandle = downloadedMetadataIter.value();
|
const lt::torrent_handle nativeHandle = downloadedMetadataIter.value();
|
||||||
|
m_downloadedMetadata.erase(downloadedMetadataIter);
|
||||||
|
|
||||||
|
if (!nativeHandle.is_valid())
|
||||||
|
return true;
|
||||||
|
|
||||||
#ifdef QBT_USES_LIBTORRENT2
|
#ifdef QBT_USES_LIBTORRENT2
|
||||||
const InfoHash infoHash {nativeHandle.info_hashes()};
|
const InfoHash infoHash {nativeHandle.info_hashes()};
|
||||||
if (infoHash.isHybrid())
|
if (infoHash.isHybrid())
|
||||||
|
@ -2445,7 +2450,7 @@ bool SessionImpl::cancelDownloadMetadata(const TorrentID &id)
|
||||||
m_downloadedMetadata.remove((altID == downloadedMetadataIter.key()) ? id : altID);
|
m_downloadedMetadata.remove((altID == downloadedMetadataIter.key()) ? id : altID);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
m_downloadedMetadata.erase(downloadedMetadataIter);
|
|
||||||
m_nativeSession->remove_torrent(nativeHandle, lt::session::delete_files);
|
m_nativeSession->remove_torrent(nativeHandle, lt::session::delete_files);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue