Correctly handle "torrent finished" events

PR #21786.
Closes #21699.
This commit is contained in:
Vladimir Golovnev 2024-11-08 11:45:57 +03:00 committed by GitHub
parent 4bec9b90c4
commit 33e3fb2f46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5238,9 +5238,6 @@ void SessionImpl::handleMoveTorrentStorageJobFinished(const Path &newPath)
if (torrent) if (torrent)
{ {
torrent->handleMoveStorageJobFinished(newPath, finishedJob.context, torrentHasOutstandingJob); torrent->handleMoveStorageJobFinished(newPath, finishedJob.context, torrentHasOutstandingJob);
// The torrent may become "finished" at the end of the move if it was moved
// from the "incomplete" location after downloading finished.
processPendingFinishedTorrents();
} }
else if (!torrentHasOutstandingJob) else if (!torrentHasOutstandingJob)
{ {
@ -5535,6 +5532,9 @@ void SessionImpl::readAlerts()
} }
} }
// Some torrents may become "finished" after different alerts handling.
processPendingFinishedTorrents();
processTrackerStatuses(); processTrackerStatuses();
} }
@ -6180,8 +6180,6 @@ void SessionImpl::handleStateUpdateAlert(const lt::state_update_alert *alert)
if (!updatedTorrents.isEmpty()) if (!updatedTorrents.isEmpty())
emit torrentsUpdated(updatedTorrents); emit torrentsUpdated(updatedTorrents);
processPendingFinishedTorrents();
if (m_needSaveTorrentsQueue) if (m_needSaveTorrentsQueue)
saveTorrentsQueue(); saveTorrentsQueue();