From 9ffde514040a5da1c025e1bebc83b738198cfb58 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 11 May 2007 23:41:31 +0000 Subject: [PATCH] fixed a bug caused by file_pool being destructed before torrents, and torrents using the file pool in their destructors --- include/libtorrent/aux_/session_impl.hpp | 13 ++++++++----- src/session_impl.cpp | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 326d7f4bc..49c79bdc0 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -312,6 +312,14 @@ namespace libtorrent io_service m_io_service; asio::strand m_strand; + // the file pool that all storages in this session's + // torrents uses. It sets a limit on the number of + // open files by this session. + // file pool must be destructed after the torrents + // since they will still have references to it + // when they are destructed. + file_pool m_files; + // the bandwidth manager is responsible for // handing out bandwidth to connections that // asks for it, it can also throttle the @@ -391,11 +399,6 @@ namespace libtorrent // NAT or not. bool m_incoming_connection; - // the file pool that all storages in this session's - // torrents uses. It sets a limit on the number of - // open files by this session. - file_pool m_files; - void second_tick(asio::error_code const& e); ptime m_last_tick; diff --git a/src/session_impl.cpp b/src/session_impl.cpp index d9f7a1bcc..9aae25e12 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -477,6 +477,7 @@ namespace libtorrent { namespace detail , fingerprint const& cl_fprint , char const* listen_interface) : m_strand(m_io_service) + , m_files(40) , m_dl_bandwidth_manager(m_io_service, peer_connection::download_channel) , m_ul_bandwidth_manager(m_io_service, peer_connection::upload_channel) , m_tracker_manager(m_settings, m_tracker_proxy) @@ -488,7 +489,6 @@ namespace libtorrent { namespace detail , m_max_uploads(-1) , m_max_connections(-1) , m_incoming_connection(false) - , m_files(40) , m_last_tick(time_now()) #ifndef TORRENT_DISABLE_DHT , m_dht_same_port(true)