[System] Fix restart-loops upon restart-then-quit (#18723)
I observed under macOS (although the bug seems platform agnostic to me) that when restarting a game, then subsequently quitting it, I'd get stuck in a 'restart loop' where the game would restart upon completely shutting down, and this would repeat every time I tried to close the game until I gave up & force quit RPCS3. Seems like for whatever reason, the use of std::move didn't actually guarantee that after_kill_callback got nuked if at all, so all I've done is take a hammer to the fucker and manually set it to nullptr after being called. Co-authored-by: Elad <18193363+elad335@users.noreply.github.com>
This commit is contained in:
@@ -4068,8 +4068,7 @@ void Emulator::Kill(bool allow_autoexit, bool savestate, savestate_stage* save_s
|
|||||||
if (after_kill_callback)
|
if (after_kill_callback)
|
||||||
{
|
{
|
||||||
// Make after_kill_callback empty before call
|
// Make after_kill_callback empty before call
|
||||||
const auto callback = std::move(after_kill_callback);
|
std::exchange(ensure(after_kill_callback), nullptr)();
|
||||||
callback();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
@@ -4125,7 +4124,7 @@ game_boot_result Emulator::Restart(bool graceful, bool reset_path)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Execute and empty the callback
|
// Execute and empty the callback
|
||||||
::as_rvalue(std::move(Emu.after_kill_callback))();
|
std::exchange(ensure(Emu.after_kill_callback), nullptr)();
|
||||||
}
|
}
|
||||||
|
|
||||||
return game_boot_result::no_errors;
|
return game_boot_result::no_errors;
|
||||||
|
|||||||
Reference in New Issue
Block a user