From 0d1b70e248257d5e4ba22a5b327e4b4ee6fc1fd7 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Wed, 7 Dec 2016 01:33:48 +0200 Subject: [PATCH] Decouple dependency between Session and BandwidthScheduler during Session init. Closes #6007. --- src/base/bittorrent/session.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 865e236b7..cb2daa795 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -412,9 +412,6 @@ Session::Session(QObject *parent) connect(Net::ProxyConfigurationManager::instance(), SIGNAL(proxyConfigurationChanged()), SLOT(configureDeferred())); - if (isBandwidthSchedulerEnabled()) - enableBandwidthScheduler(); - // Network configuration monitor connect(&m_networkManager, SIGNAL(onlineStateChanged(bool)), SLOT(networkOnlineStateChanged(bool))); connect(&m_networkManager, SIGNAL(configurationAdded(const QNetworkConfiguration&)), SLOT(networkConfigurationChange(const QNetworkConfiguration&))); @@ -836,8 +833,13 @@ Session::~Session() void Session::initInstance() { - if (!m_instance) + if (!m_instance) { m_instance = new Session; + + // BandwidthScheduler::start() depends on Session being fully constructed + if (m_instance->isBandwidthSchedulerEnabled()) + m_instance->enableBandwidthScheduler(); + } } void Session::freeInstance()