Fix more race conditions if you exit during game bootup

This commit is contained in:
Henrik Rydgård committed 2026-02-24 00:56:45 +01:00
1 parent 25392ef6fd
commit 5dc169ecbe
3 files changed
+16 -6

No files matched your search

+12 -5
View File
@@ -460,13 +460,20 @@ EmuScreen::~EmuScreen() {
std::string gameID = g_paramSFO.GetValueString("DISC_ID");
g_Config.TimeTracker().Stop(gameID);
// Should not be able to quit during boot, as boot can't be cancelled.
_dbg_assert_(!bootPending_);
if (!bootPending_) {
Achievements::UnloadGame();
PSP_Shutdown(true);
if (bootPending_) {
// We probably quit during boot, got blocked in lostdevice, and then didn't end up in update again to call PSP_InitUpdate.
// So we need to finish and join the boot thread before we can exit.
_dbg_assert_(PollBootState() != BootState::Booting);
// Make sure we join the boot thread, by calling PSP_InitUpdate.
std::string error_string = "(unknown error)";
PSP_InitUpdate(&error_string);
ERROR_LOG(Log::G3D, "Quit during boot, not good. %s", error_string.c_str());
bootPending_ = false;
}
Achievements::UnloadGame();
PSP_Shutdown(true);
// If achievements are disabled in the global config, let's shut it down here.
if (!g_Config.bAchievementsEnable) {
Achievements::Shutdown();