diff --git a/libtorrent/src/natpmp.cpp b/libtorrent/src/natpmp.cpp index 55b274774..9fbe3182d 100644 --- a/libtorrent/src/natpmp.cpp +++ b/libtorrent/src/natpmp.cpp @@ -281,6 +281,7 @@ void natpmp::send_map_request(int i) void natpmp::resend_request(int i, error_code const& e) { if (e) return; + if (m_abort) return; mutex_t::scoped_lock l(m_mutex); if (m_currently_mapping != i) return; diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index ba76445b3..59d1e65a6 100755 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -398,6 +398,7 @@ namespace aux { #endif // abort the main thread m_abort = true; + m_queued_for_checking.clear(); if (m_lsd) m_lsd->close(); if (m_upnp) m_upnp->close(); if (m_natpmp) m_natpmp->close(); @@ -1802,12 +1803,14 @@ namespace aux { void session_impl::check_torrent(boost::shared_ptr const& t) { + if (m_abort) return; if (m_queued_for_checking.empty()) t->start_checking(); m_queued_for_checking.push_back(t); } void session_impl::done_checking(boost::shared_ptr const& t) { + if (m_queued_for_checking.empty()) return; check_queue_t::iterator next_check = m_queued_for_checking.begin(); check_queue_t::iterator done = m_queued_for_checking.end(); for (check_queue_t::iterator i = m_queued_for_checking.begin() diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index 1bef95c6d..cb9a74175 100755 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -3686,8 +3686,20 @@ namespace libtorrent if (m_owning_storage.get()) { TORRENT_ASSERT(m_storage); - m_storage->async_save_resume_data( - bind(&torrent::on_save_resume_data, shared_from_this(), _1, _2)); + if (m_state == torrent_status::queued_for_checking + || m_state == torrent_status::checking_files) + { + if (alerts().should_post(alert::warning)) + { + alerts().post_alert(save_resume_data_alert(boost::shared_ptr() + , get_handle(), "won't save resume data, torrent does not have a complete resume state yet")); + } + } + else + { + m_storage->async_save_resume_data( + bind(&torrent::on_save_resume_data, shared_from_this(), _1, _2)); + } } else {