mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-23 06:35:24 -07:00
Discard obsolete "state update" events after torrent is reloaded
Closes #21827.
This commit is contained in:
parent
f4eec75488
commit
eeac7bc3f2
1 changed files with 6 additions and 0 deletions
|
@ -2635,6 +2635,12 @@ bool TorrentImpl::isMoveInProgress() const
|
||||||
|
|
||||||
void TorrentImpl::updateStatus(const lt::torrent_status &nativeStatus)
|
void TorrentImpl::updateStatus(const lt::torrent_status &nativeStatus)
|
||||||
{
|
{
|
||||||
|
// Since libtorrent alerts are handled asynchronously there can be obsolete
|
||||||
|
// "state update" event reached here after torrent was reloaded in libtorrent.
|
||||||
|
// Just discard such events.
|
||||||
|
if (nativeStatus.handle != m_nativeHandle) [[unlikely]]
|
||||||
|
return;
|
||||||
|
|
||||||
const lt::torrent_status oldStatus = std::exchange(m_nativeStatus, nativeStatus);
|
const lt::torrent_status oldStatus = std::exchange(m_nativeStatus, nativeStatus);
|
||||||
|
|
||||||
if (m_nativeStatus.num_pieces != oldStatus.num_pieces)
|
if (m_nativeStatus.num_pieces != oldStatus.num_pieces)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue