From 4178626d08b8da8bf793115df617c858ad2dbc42 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 1 Jan 2025 13:39:02 +0800 Subject: [PATCH] Simplify captured variable type By capturing the specific data instead of torrent handle the lambda can become non-mutable. --- src/base/bittorrent/sessionimpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/bittorrent/sessionimpl.cpp b/src/base/bittorrent/sessionimpl.cpp index 32034d370..308130206 100644 --- a/src/base/bittorrent/sessionimpl.cpp +++ b/src/base/bittorrent/sessionimpl.cpp @@ -6328,7 +6328,7 @@ void SessionImpl::loadStatistics() void SessionImpl::updateTrackerEntryStatuses(lt::torrent_handle torrentHandle) { - invokeAsync([this, torrentHandle = std::move(torrentHandle)]() mutable + invokeAsync([this, torrentHandle = std::move(torrentHandle)] { try { @@ -6338,9 +6338,9 @@ void SessionImpl::updateTrackerEntryStatuses(lt::torrent_handle torrentHandle) QHash>> updatedTrackers = m_updatedTrackerStatuses.take(torrentHandle); updatedTrackerStatusesLocker.unlock(); - invoke([this, torrentHandle, nativeTrackers = std::move(nativeTrackers), updatedTrackers = std::move(updatedTrackers)] + invoke([this, infoHash = torrentHandle.info_hash(), nativeTrackers = std::move(nativeTrackers), updatedTrackers = std::move(updatedTrackers)] { - TorrentImpl *torrent = m_torrents.value(torrentHandle.info_hash()); + TorrentImpl *torrent = m_torrents.value(infoHash); if (!torrent || torrent->isStopped()) return;