Browse Source

Merge pull request #12603 from glassez/fix-crash

Fix crash when torrent is deleted on limit reached
adaptive-webui-19844
Vladimir Golovnev 5 years ago committed by GitHub
parent
commit
4b897e7702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/base/bittorrent/session.cpp

5
src/base/bittorrent/session.cpp

@ -1693,7 +1693,10 @@ void Session::processShareLimits()
{ {
qDebug("Processing share limits..."); qDebug("Processing share limits...");
for (TorrentHandleImpl *const torrent : asConst(m_torrents)) { // We shouldn't iterate over `m_torrents` in the loop below
// since `deleteTorrent()` modifies it indirectly
const QHash<InfoHash, TorrentHandleImpl *> torrents {m_torrents};
for (TorrentHandleImpl *const torrent : torrents) {
if (torrent->isSeed() && !torrent->isForced()) { if (torrent->isSeed() && !torrent->isForced()) {
if (torrent->ratioLimit() != TorrentHandle::NO_RATIO_LIMIT) { if (torrent->ratioLimit() != TorrentHandle::NO_RATIO_LIMIT) {
const qreal ratio = torrent->realRatio(); const qreal ratio = torrent->realRatio();

Loading…
Cancel
Save