From 4a7d982a2bcbe5c8b51b504f76f8f598c461da24 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 9 Mar 2024 17:54:35 +0100 Subject: [PATCH] Qt: make sure the gamelist refresh progress dialog runs on the main thread --- rpcs3/rpcs3qt/game_list_frame.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 1d743c49cb..b2b44511dc 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -316,8 +316,21 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after) m_games.pop_all(); m_progress_dialog = new progress_dialog(tr("Loading games"), tr("Loading games, please wait..."), tr("Cancel"), 0, 0, true, this, Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint); - connect(&m_refresh_watcher, &QFutureWatcher::progressRangeChanged, m_progress_dialog, &QProgressDialog::setRange); - connect(&m_refresh_watcher, &QFutureWatcher::progressValueChanged, m_progress_dialog, &QProgressDialog::setValue); + + connect(&m_refresh_watcher, &QFutureWatcher::progressRangeChanged, this, [this](int minimum, int maximum) + { + if (m_progress_dialog) + { + m_progress_dialog->SetRange(minimum, maximum); + } + }, Qt::QueuedConnection); + connect(&m_refresh_watcher, &QFutureWatcher::progressValueChanged, this, [this](int value) + { + if (m_progress_dialog) + { + m_progress_dialog->SetValue(value); + } + }, Qt::QueuedConnection); connect(m_progress_dialog, &QProgressDialog::canceled, this, [this]() { gui::utils::stop_future_watcher(m_parsing_watcher, true);