Fix segfault on missing firmware

Wait until kill to close the gs_frame on error
This commit is contained in:
Megamouse 2025-01-25 15:49:45 +01:00
parent 664e09f1ff
commit 0ef2e96121

View File

@ -987,21 +987,26 @@ game_boot_result Emulator::BootGame(const std::string& path, const std::string&
if (m_state == system_state::stopped) 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); 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 else
{ {
ensure(m_state == system_state::stopping); ensure(m_state == system_state::stopping);
// Execute after Kill() is done // 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); 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) if (result != game_boot_result::no_errors)
{ {
GetCallbacks().close_gs_frame(); GetCallbacks().close_gs_frame();
}
};
} }
} }