From 65c4b7ec13dd119e541ff8f4c1c1867a78d74549 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 26 Oct 2008 09:23:00 +0000 Subject: [PATCH] fix for when removing a torrent when it is in the checking state --- src/session_impl.cpp | 2 +- src/torrent.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index b6d2bf475..575e8f487 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1891,7 +1891,7 @@ namespace aux { #ifndef NDEBUG sha1_hash i_hash = t.torrent_file().info_hash(); #endif - i->second->set_queue_position(-1); + t.set_queue_position(-1); m_torrents.erase(i); std::list >::iterator k = std::find(m_queued_for_checking.begin(), m_queued_for_checking.end(), tptr); diff --git a/src/torrent.cpp b/src/torrent.cpp index 670bc9c61..9f045eec5 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -784,7 +784,7 @@ namespace libtorrent // we're done, or encounter a failure if (ret == piece_manager::need_full_check) return; - m_ses.done_checking(shared_from_this()); + if (!m_abort) m_ses.done_checking(shared_from_this()); files_checked(); } @@ -1624,7 +1624,10 @@ namespace libtorrent if (m_owning_storage.get()) m_storage->async_release_files( bind(&torrent::on_files_released, shared_from_this(), _1, _2)); - + + if (m_state == torrent_status::checking_files) + m_ses.done_checking(shared_from_this()); + m_owning_storage = 0; m_host_resolver.cancel(); }