From 774167e3380f302cb994d7ba4b17ae3c0b547778 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 22 May 2015 09:46:19 +0200 Subject: [PATCH] Fixed lockup when checking for updates after start. --- src/miscellaneous/systemfactory.cpp | 15 +++------------ src/miscellaneous/systemfactory.h | 9 +-------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/miscellaneous/systemfactory.cpp b/src/miscellaneous/systemfactory.cpp index 724298204..c61785f2d 100755 --- a/src/miscellaneous/systemfactory.cpp +++ b/src/miscellaneous/systemfactory.cpp @@ -237,8 +237,7 @@ UpdateInfo SystemFactory::parseUpdatesFile(const QByteArray &updates_file, const url.m_os = url_elem.attributes().namedItem("os").toAttr().value(); url.m_platform = url_elem.attributes().namedItem("platform").toAttr().value(); - update.m_urls.insert(url.m_os, - url); + update.m_urls.insert(url.m_os, url); } } else { @@ -249,16 +248,8 @@ UpdateInfo SystemFactory::parseUpdatesFile(const QByteArray &updates_file, const return update; } -void SystemFactory::checkForUpdatesAsynchronously() { - QFutureWatcher *watcher_for_future = new QFutureWatcher(this); - - connect(watcher_for_future, SIGNAL(finished()), this, SLOT(handleBackgroundUpdatesCheck())); - watcher_for_future->setFuture(QtConcurrent::run(this, &SystemFactory::checkForUpdates)); -} - -void SystemFactory::handleBackgroundUpdatesCheck() { - QFutureWatcher *future_watcher = static_cast*>(sender()); - UpdateCheck updates = future_watcher->result(); +void SystemFactory::checkForUpdatesOnStartup() { + UpdateCheck updates = checkForUpdates(); if (updates.second == QNetworkReply::NoError && isUpdateNewer(updates.first.m_availableVersion)) { if (SystemTrayIcon::isSystemTrayActivated()) { diff --git a/src/miscellaneous/systemfactory.h b/src/miscellaneous/systemfactory.h index 6a530eb23..d729175c5 100755 --- a/src/miscellaneous/systemfactory.h +++ b/src/miscellaneous/systemfactory.h @@ -86,14 +86,7 @@ class SystemFactory : public QObject { static bool isUpdateNewer(const QString &update_version); public slots: - // Performs asynchronous check for updates, result is emitted via updateCheckedAsynchronously(...) signal. - void checkForUpdatesAsynchronously(); - - private slots: - void handleBackgroundUpdatesCheck(); - - signals: - void updateCheckedAsynchronously(QPair update_info); + void checkForUpdatesOnStartup(); private: // Performs parsing of downloaded file with list of updates.