mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 19:26:59 +03:00
Fix bug of "move storage job" can be performed multiple times
This commit is contained in:
parent
fa6524d377
commit
f6d1fea9b7
1 changed files with 11 additions and 14 deletions
|
@ -4065,6 +4065,8 @@ void Session::moveTorrentStorage(const MoveStorageJob &job) const
|
||||||
void Session::handleMoveTorrentStorageJobFinished()
|
void Session::handleMoveTorrentStorageJobFinished()
|
||||||
{
|
{
|
||||||
const MoveStorageJob finishedJob = m_moveStorageQueue.takeFirst();
|
const MoveStorageJob finishedJob = m_moveStorageQueue.takeFirst();
|
||||||
|
if (!m_moveStorageQueue.isEmpty())
|
||||||
|
moveTorrentStorage(m_moveStorageQueue.first());
|
||||||
|
|
||||||
const auto iter = std::find_if(m_moveStorageQueue.cbegin(), m_moveStorageQueue.cend()
|
const auto iter = std::find_if(m_moveStorageQueue.cbegin(), m_moveStorageQueue.cend()
|
||||||
, [&finishedJob](const MoveStorageJob &job)
|
, [&finishedJob](const MoveStorageJob &job)
|
||||||
|
@ -4076,22 +4078,17 @@ void Session::handleMoveTorrentStorageJobFinished()
|
||||||
|
|
||||||
TorrentHandleImpl *torrent = m_torrents.value(finishedJob.torrentHandle.info_hash());
|
TorrentHandleImpl *torrent = m_torrents.value(finishedJob.torrentHandle.info_hash());
|
||||||
if (torrent)
|
if (torrent)
|
||||||
torrent->handleMoveStorageJobFinished(torrentHasOutstandingJob);
|
|
||||||
|
|
||||||
if (!torrentHasOutstandingJob)
|
|
||||||
{
|
{
|
||||||
if (!torrent)
|
torrent->handleMoveStorageJobFinished(torrentHasOutstandingJob);
|
||||||
{
|
}
|
||||||
// Last job is completed for torrent that being removing, so actually remove it
|
else if (!torrentHasOutstandingJob)
|
||||||
const lt::torrent_handle nativeHandle {finishedJob.torrentHandle};
|
{
|
||||||
const RemovingTorrentData &removingTorrentData = m_removingTorrents[nativeHandle.info_hash()];
|
// Last job is completed for torrent that being removing, so actually remove it
|
||||||
if (removingTorrentData.deleteOption == Torrent)
|
const lt::torrent_handle nativeHandle {finishedJob.torrentHandle};
|
||||||
m_nativeSession->remove_torrent(nativeHandle, lt::session::delete_partfile);
|
const RemovingTorrentData &removingTorrentData = m_removingTorrents[nativeHandle.info_hash()];
|
||||||
}
|
if (removingTorrentData.deleteOption == Torrent)
|
||||||
|
m_nativeSession->remove_torrent(nativeHandle, lt::session::delete_partfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_moveStorageQueue.isEmpty())
|
|
||||||
moveTorrentStorage(m_moveStorageQueue.first());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::handleTorrentTrackerWarning(TorrentHandleImpl *const torrent, const QString &trackerUrl)
|
void Session::handleTorrentTrackerWarning(TorrentHandleImpl *const torrent, const QString &trackerUrl)
|
||||||
|
|
Loading…
Reference in a new issue