From 21a72c651f4439352942bec3573f0325b99765e9 Mon Sep 17 00:00:00 2001 From: Eugene Shalygin Date: Fri, 14 Apr 2017 00:43:09 +0200 Subject: [PATCH] Start up torrents after UI was created. Fixes #6454. Commit dd0537d changed torrents startup code adding alerts processing into it. Therefore alerts were processed before UI code subscribed to signals and therefore part of alerts was not reflected in the UI. Thus here we do not start torrents in Session constructor, but do that from Application::exec() after UI was constructed and is ready to process signals. --- src/app/application.cpp | 3 +++ src/base/bittorrent/session.cpp | 1 - src/base/bittorrent/session.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index 061604f71..56a0906f9 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -462,6 +462,9 @@ int Application::exec(const QStringList ¶ms) m_paramsQueue.clear(); } + // Now UI is ready to process signals from Session + BitTorrent::Session::instance()->startUpTorrents(); + return BaseApplication::exec(); } diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 56474550e..d521141fd 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -440,7 +440,6 @@ Session::Session(QObject *parent) Net::PortForwarder::initInstance(m_nativeSession); qDebug("* BitTorrent Session constructed"); - startUpTorrents(); } bool Session::isDHTEnabled() const diff --git a/src/base/bittorrent/session.h b/src/base/bittorrent/session.h index adeae914a..bdfc0d899 100644 --- a/src/base/bittorrent/session.h +++ b/src/base/bittorrent/session.h @@ -330,6 +330,7 @@ namespace BitTorrent QStringList bannedIPs() const; void setBannedIPs(const QStringList &list); + void startUpTorrents(); TorrentHandle *findTorrent(const InfoHash &hash) const; QHash torrents() const; TorrentStatusReport torrentStatusReport() const; @@ -460,7 +461,6 @@ namespace BitTorrent void enableIPFilter(); void disableIPFilter(); - void startUpTorrents(); bool addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri, TorrentInfo torrentInfo = TorrentInfo(), const QByteArray &fastresumeData = QByteArray());