From 33e3fb2f46f06429981e1980a49565ada06bd370 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Fri, 8 Nov 2024 11:45:57 +0300 Subject: [PATCH] Correctly handle "torrent finished" events PR #21786. Closes #21699. --- src/base/bittorrent/sessionimpl.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/base/bittorrent/sessionimpl.cpp b/src/base/bittorrent/sessionimpl.cpp index 38f25693f..cc0796df8 100644 --- a/src/base/bittorrent/sessionimpl.cpp +++ b/src/base/bittorrent/sessionimpl.cpp @@ -5238,9 +5238,6 @@ void SessionImpl::handleMoveTorrentStorageJobFinished(const Path &newPath) if (torrent) { 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) { @@ -5535,6 +5532,9 @@ void SessionImpl::readAlerts() } } + // Some torrents may become "finished" after different alerts handling. + processPendingFinishedTorrents(); + processTrackerStatuses(); } @@ -6180,8 +6180,6 @@ void SessionImpl::handleStateUpdateAlert(const lt::state_update_alert *alert) if (!updatedTorrents.isEmpty()) emit torrentsUpdated(updatedTorrents); - processPendingFinishedTorrents(); - if (m_needSaveTorrentsQueue) saveTorrentsQueue();