From 0ef2e961216ff80eae05bbb2f53ec6296ebf8782 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 25 Jan 2025 15:49:45 +0100 Subject: [PATCH] Fix segfault on missing firmware Wait until kill to close the gs_frame on error --- rpcs3/Emu/System.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 424b540491..21785a32be 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -987,21 +987,26 @@ game_boot_result Emulator::BootGame(const std::string& path, const std::string& if (m_state == system_state::stopped) { std::tie(m_path, m_path_original, argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_path) = std::move(save_args); + + if (result != game_boot_result::no_errors) + { + GetCallbacks().close_gs_frame(); + } } else { ensure(m_state == system_state::stopping); // Execute after Kill() is done - Emu.after_kill_callback = [save_args = std::move(save_args), this]() mutable + Emu.after_kill_callback = [this, result, save_args = std::move(save_args)]() mutable { std::tie(m_path, m_path_original, argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_path) = std::move(save_args); - }; - } - if (result != game_boot_result::no_errors) - { - GetCallbacks().close_gs_frame(); + if (result != game_boot_result::no_errors) + { + GetCallbacks().close_gs_frame(); + } + }; } }