Fix async result handlers

PR #22669.
Closes #22644.
This commit is contained in:
Vladimir Golovnev
2025-05-10 10:17:35 +03:00
committed by GitHub
parent d29f47c36e
commit dcaf4b6d80
4 changed files with 21 additions and 19 deletions

View File

@@ -312,14 +312,14 @@ void TrackerListModel::populate()
using TorrentPtr = QPointer<const BitTorrent::Torrent>;
m_torrent->fetchPeerInfo().then(this, [this, torrent = TorrentPtr(m_torrent)](const QList<BitTorrent::PeerInfo> &peers)
{
if (torrent != m_torrent)
if (!m_torrent || (m_torrent != torrent))
return;
// XXX: libtorrent should provide this info...
// Count peers from DHT, PeX, LSD
uint seedsDHT = 0, seedsPeX = 0, seedsLSD = 0, peersDHT = 0, peersPeX = 0, peersLSD = 0;
for (const BitTorrent::PeerInfo &peer : peers)
{
// XXX: libtorrent should provide this info...
// Count peers from DHT, PeX, LSD
uint seedsDHT = 0, seedsPeX = 0, seedsLSD = 0, peersDHT = 0, peersPeX = 0, peersLSD = 0;
for (const BitTorrent::PeerInfo &peer : peers)
{
if (peer.isConnecting())
continue;