Simplify captured variable type

By capturing the specific data instead of torrent handle the lambda can become non-mutable.

PR #22102.
This commit is contained in:
Chocobo1 2025-01-06 18:22:43 +08:00 committed by GitHub
parent 6fe02895a8
commit 22e156e0af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6328,7 +6328,7 @@ void SessionImpl::loadStatistics()
void SessionImpl::updateTrackerEntryStatuses(lt::torrent_handle torrentHandle) void SessionImpl::updateTrackerEntryStatuses(lt::torrent_handle torrentHandle)
{ {
invokeAsync([this, torrentHandle = std::move(torrentHandle)]() mutable invokeAsync([this, torrentHandle = std::move(torrentHandle)]
{ {
try try
{ {
@ -6338,9 +6338,9 @@ void SessionImpl::updateTrackerEntryStatuses(lt::torrent_handle torrentHandle)
QHash<std::string, QHash<lt::tcp::endpoint, QMap<int, int>>> updatedTrackers = m_updatedTrackerStatuses.take(torrentHandle); QHash<std::string, QHash<lt::tcp::endpoint, QMap<int, int>>> updatedTrackers = m_updatedTrackerStatuses.take(torrentHandle);
updatedTrackerStatusesLocker.unlock(); 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()) if (!torrent || torrent->isStopped())
return; return;