fixed crash when shutting down while checking a torrent

This commit is contained in:
Arvid Norberg 2009-04-25 08:45:13 +00:00
parent fba4ae541c
commit 6b69f1d8c4
2 changed files with 12 additions and 7 deletions

View File

@ -61,6 +61,7 @@ release 0.14.3
* fixed bug where connection would hang when receiving a keepalive
* fixed bug where an asio exception could be thrown when resolving
peer countries
* fixed crash when shutting down while checking a torrent
release 0.14.2

View File

@ -2464,6 +2464,17 @@ namespace aux {
abort();
TORRENT_ASSERT(m_connections.empty());
// we need to wait for the disk-io thread to
// die first, to make sure it won't post any
// more messages to the io_service containing references
// to disk_io_pool inside the disk_io_thread. Once
// the main thread has handled all the outstanding requests
// we know it's safe to destruct the disk thread.
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " waiting for disk io thread\n";
#endif
m_disk_thread.join();
#ifndef TORRENT_DISABLE_GEO_IP
if (m_asnum_db) GeoIP_delete(m_asnum_db);
if (m_country_db) GeoIP_delete(m_country_db);
@ -2474,13 +2485,6 @@ namespace aux {
m_thread->join();
TORRENT_ASSERT(m_torrents.empty());
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " waiting for disk io thread\n";
#endif
m_disk_thread.join();
TORRENT_ASSERT(m_torrents.empty());
TORRENT_ASSERT(m_connections.empty());
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " shutdown complete!\n";