From d5f536c595663e6e3bf4334c7667847e5c00a4e2 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Tue, 31 Mar 2026 12:43:53 -0700 Subject: [PATCH] Updater: Run manual update check on separate thread Run manual update checks on a separate thread to avoid blocking the UI, like the automatic check already does. --- Source/Core/DolphinQt/Main.cpp | 9 +++++---- Source/Core/DolphinQt/MenuBar.cpp | 7 +++---- Source/Core/DolphinQt/Updater.cpp | 15 +++++---------- Source/Core/DolphinQt/Updater.h | 5 +++-- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp index b223819e7a..a7ca8492c1 100644 --- a/Source/Core/DolphinQt/Main.cpp +++ b/Source/Core/DolphinQt/Main.cpp @@ -283,11 +283,12 @@ int main(int argc, char* argv[]) } #endif - if (!Settings::Instance().IsBatchModeEnabled()) + if (!Settings::Instance().IsBatchModeEnabled() && + AutoUpdateChecker::SystemSupportsAutoUpdates()) { - auto* updater = new Updater(&win, Config::Get(Config::MAIN_AUTOUPDATE_UPDATE_TRACK), - Config::Get(Config::MAIN_AUTOUPDATE_HASH_OVERRIDE)); - updater->start(); + new Updater(&win, Config::Get(Config::MAIN_AUTOUPDATE_UPDATE_TRACK), + Config::Get(Config::MAIN_AUTOUPDATE_HASH_OVERRIDE), + AutoUpdateChecker::CheckType::Automatic); } retval = app.exec(); diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp index f5d87e0b77..e3d5443a19 100644 --- a/Source/Core/DolphinQt/MenuBar.cpp +++ b/Source/Core/DolphinQt/MenuBar.cpp @@ -660,10 +660,9 @@ void MenuBar::InstallUpdateManually() { const std::string autoupdate_track = Config::Get(Config::MAIN_AUTOUPDATE_UPDATE_TRACK); const std::string manual_track = autoupdate_track.empty() ? "dev" : autoupdate_track; - auto* const updater = new Updater(this->parentWidget(), manual_track, - Config::Get(Config::MAIN_AUTOUPDATE_HASH_OVERRIDE)); - - updater->CheckForUpdate(); + new Updater(this->parentWidget(), manual_track, + Config::Get(Config::MAIN_AUTOUPDATE_HASH_OVERRIDE), + AutoUpdateChecker::CheckType::Manual); } void MenuBar::AddHelpMenu() diff --git a/Source/Core/DolphinQt/Updater.cpp b/Source/Core/DolphinQt/Updater.cpp index 18a109e1ad..a47a65f9a9 100644 --- a/Source/Core/DolphinQt/Updater.cpp +++ b/Source/Core/DolphinQt/Updater.cpp @@ -21,23 +21,18 @@ // Refer to docs/autoupdate_overview.md for a detailed overview of the autoupdate process -Updater::Updater(QWidget* parent, std::string update_track, std::string hash_override) +Updater::Updater(QWidget* parent, std::string update_track, std::string hash_override, + const CheckType check_type) : m_parent(parent), m_update_track(std::move(update_track)), - m_hash_override(std::move(hash_override)) + m_hash_override(std::move(hash_override)), m_check_type(check_type) { connect(this, &QThread::finished, this, &QObject::deleteLater); + start(); } void Updater::run() { - AutoUpdateChecker::CheckForUpdate(m_update_track, m_hash_override, - AutoUpdateChecker::CheckType::Automatic); -} - -void Updater::CheckForUpdate() -{ - AutoUpdateChecker::CheckForUpdate(m_update_track, m_hash_override, - AutoUpdateChecker::CheckType::Manual); + AutoUpdateChecker::CheckForUpdate(m_update_track, m_hash_override, m_check_type); } void Updater::OnUpdateAvailable(const NewVersionInformation& info) diff --git a/Source/Core/DolphinQt/Updater.h b/Source/Core/DolphinQt/Updater.h index 34739a6398..5903dffa61 100644 --- a/Source/Core/DolphinQt/Updater.h +++ b/Source/Core/DolphinQt/Updater.h @@ -17,14 +17,15 @@ class Updater : public QThread, public AutoUpdateChecker { Q_OBJECT public: - explicit Updater(QWidget* parent, std::string update_track, std::string hash_override); + explicit Updater(QWidget* parent, std::string update_track, std::string hash_override, + CheckType check_type); void run() override; void OnUpdateAvailable(const NewVersionInformation& info) override; - void CheckForUpdate(); private: QWidget* m_parent; std::string m_update_track; std::string m_hash_override; + CheckType m_check_type; };