mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-05-07 13:37:46 +00:00
Fix ASan fatal-report access during emulator teardown
This commit is contained in:
parent
7168cd566a
commit
f463c128e3
3 changed files with 34 additions and 8 deletions
|
|
@ -70,6 +70,8 @@ LOG_CHANNEL(sys_log, "SYS");
|
|||
// Preallocate 32 MiB
|
||||
stx::manual_typemap<void, 0x20'00000, 128> g_fixed_typemap;
|
||||
|
||||
static constinit atomic_t<bool> s_emulator_available{false};
|
||||
|
||||
std::string g_cfg_defaults;
|
||||
|
||||
atomic_t<u64> g_watchdog_hold_ctr{0};
|
||||
|
|
@ -118,6 +120,21 @@ namespace rsx
|
|||
void set_native_ui_flip();
|
||||
}
|
||||
|
||||
Emulator::Emulator() noexcept
|
||||
{
|
||||
s_emulator_available = true;
|
||||
}
|
||||
|
||||
Emulator::~Emulator() noexcept
|
||||
{
|
||||
s_emulator_available = false;
|
||||
}
|
||||
|
||||
bool Emulator::IsAvailable() noexcept
|
||||
{
|
||||
return s_emulator_available.load();
|
||||
}
|
||||
|
||||
template<>
|
||||
void fmt_class_string<game_boot_result>::format(std::string& out, u64 arg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -201,8 +201,10 @@ public:
|
|||
static constexpr std::string_view game_id_boot_prefix = "%RPCS3_GAMEID%:";
|
||||
static constexpr std::string_view vfs_boot_prefix = "%RPCS3_VFS%:";
|
||||
|
||||
Emulator() noexcept = default;
|
||||
~Emulator() noexcept = default;
|
||||
Emulator() noexcept;
|
||||
~Emulator() noexcept;
|
||||
|
||||
static bool IsAvailable() noexcept;
|
||||
|
||||
void SetCallbacks(EmuCallbacks&& cb)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -185,16 +185,23 @@ std::set<std::string> get_one_drive_paths()
|
|||
fmt::append(buf, "\nSerialized Object: %s", g_tls_serialize_name);
|
||||
}
|
||||
|
||||
const system_state state = Emu.GetStatus(false);
|
||||
|
||||
if (state == system_state::stopped)
|
||||
if (Emulator::IsAvailable())
|
||||
{
|
||||
fmt::append(buf, "\nEmulation is stopped");
|
||||
const system_state state = Emu.GetStatus(false);
|
||||
|
||||
if (state == system_state::stopped)
|
||||
{
|
||||
fmt::append(buf, "\nEmulation is stopped");
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string name = Emu.GetTitleAndTitleID();
|
||||
fmt::append(buf, "\nTitle: \"%s\" (emulation is %s)", name.empty() ? "N/A" : name.c_str(), state == system_state::stopping ? "stopping" : "running");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string& name = Emu.GetTitleAndTitleID();
|
||||
fmt::append(buf, "\nTitle: \"%s\" (emulation is %s)", name.empty() ? "N/A" : name.data(), state == system_state::stopping ? "stopping" : "running");
|
||||
fmt::append(buf, "\nEmulation object is unavailable (process teardown)");
|
||||
}
|
||||
|
||||
fmt::append(buf, "\nBuild: \"%s\"", rpcs3::get_verbose_version());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue