From e89a568765bb16fa055c8d1134cb2cebd2aa5fe6 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sat, 21 Nov 2020 17:23:28 +0300 Subject: [PATCH] Attempt to fix Emu.Quit() There was some kind of "initialization order fiasco" of g_fxo. Not only should it be used after main, but also destroyed before exit. --- rpcs3/Emu/System.cpp | 3 +++ rpcs3/util/fixed_typemap.hpp | 1 + 2 files changed, 4 insertions(+) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 0b1f208fd0..9566939b62 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1971,6 +1971,9 @@ bool Emulator::Quit(bool force_quit) m_force_boot = false; Emu.Stop(); + // Deinitialize object manager to prevent any hanging objects at program exit + *g_fxo = {}; + return GetCallbacks().exit(force_quit); } diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp index 65b90f3161..c854d5cf84 100644 --- a/rpcs3/util/fixed_typemap.hpp +++ b/rpcs3/util/fixed_typemap.hpp @@ -101,6 +101,7 @@ namespace stx std::swap(m_list, x.m_list); std::swap(m_order, x.m_order); std::swap(m_init_count, x.m_init_count); + return *this; } ~manual_fixed_typemap()