diff --git a/src/control.cc b/src/control.cc index bb18ab60..17b39f0d 100644 --- a/src/control.cc +++ b/src/control.cc @@ -45,6 +45,7 @@ #include "core/download_store.h" #include "core/view_manager.h" #include "core/dht_manager.h" +#include "core/http_queue.h" #include "display/canvas.h" #include "display/window.h" @@ -149,7 +150,16 @@ Control::cleanup_exception() { bool Control::is_shutdown_completed() { - return m_shutdownQuick && !worker_thread->is_active() && torrent::is_inactive(); + if (!m_shutdownQuick || worker_thread->is_active()) + return false; + + // Tracker requests can be disowned, so wait for these to + // finish. The edge case of torrent http downloads may delay + // shutdown. + if (!core()->http_stack()->empty() || !core()->http_queue()->empty()) + return false; + + return torrent::is_inactive(); } void diff --git a/src/control.h b/src/control.h index 474614a3..92a18893 100644 --- a/src/control.h +++ b/src/control.h @@ -94,7 +94,6 @@ public: core::ViewManager* view_manager() { return m_viewManager; } core::DhtManager* dht_manager() { return m_dhtManager; } - ui::Root* ui() { return m_ui; } display::Manager* display() { return m_display; } input::Manager* input() { return m_input; }