diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 58430bc3b1..0cb925657d 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -231,6 +231,11 @@ void game_list_frame::LoadSettings() } game_list_frame::~game_list_frame() +{ + StopAllThreads(); +} + +void game_list_frame::StopAllThreads() { WaitAndAbortSizeCalcThreads(); WaitAndAbortRepaintThreads(); diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index 5e4156f09d..a34b5f3fab 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -35,6 +35,8 @@ public: explicit game_list_frame(std::shared_ptr gui_settings, std::shared_ptr emu_settings, std::shared_ptr persistent_settings, QWidget* parent = nullptr); ~game_list_frame(); + void StopAllThreads(); + /** Refresh the gamelist with/without loading game data from files. Public so that main frame can refresh after vfs or install */ void Refresh(const bool from_drive = false, const std::vector& serials_to_remove_from_yml = {}, const bool scroll_after = true); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 5fd5bac9c6..be09691e84 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -265,6 +265,13 @@ bool main_window::Init([[maybe_unused]] bool with_cli_boot) ui->menuBar->cornerWidget()->setVisible(update_available); } }); + connect(&m_updater, &update_manager::signal_about_to_terminate, this, [this]() + { + if (m_game_list_frame) + { + m_game_list_frame->StopAllThreads(); + } + }); #ifdef RPCS3_UPDATE_SUPPORTED if (const auto update_value = m_gui_settings->GetValue(gui::m_check_upd_start).toString(); update_value != gui::update_off) diff --git a/rpcs3/rpcs3qt/update_manager.cpp b/rpcs3/rpcs3qt/update_manager.cpp index 8b07693e34..5102ffea41 100644 --- a/rpcs3/rpcs3qt/update_manager.cpp +++ b/rpcs3/rpcs3qt/update_manager.cpp @@ -766,6 +766,8 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept) m_gui_settings->sync(); // Make sure to sync before terminating RPCS3 } + Q_EMIT signal_about_to_terminate(); + Emu.GracefulShutdown(false); Emu.CleanUp(); diff --git a/rpcs3/rpcs3qt/update_manager.h b/rpcs3/rpcs3qt/update_manager.h index f6a534b0b2..3c23d0aa47 100644 --- a/rpcs3/rpcs3qt/update_manager.h +++ b/rpcs3/rpcs3qt/update_manager.h @@ -45,4 +45,5 @@ public: Q_SIGNALS: void signal_update_available(bool update_available); + void signal_about_to_terminate(); };