mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Core, VideoCommon: Fix crash at shutdown due to destructor ordering
Previously, PerformanceTracker registered a callback to be updated on emulation state changes. PerformanceTrackers live in a global variable (g_perf_metrics) within libvideocommon. The callback was stored in a global variable in libcore. This created a race condition at shutdown between these libraries, when the PerfTracker's destructor tried to unregister the callback. Notify the PerfTracker directly from libcore, without callbacks, since Core.cpp already references g_perf_metrics explicitly. Also rename Core::CallOnStateChangedCallbacks to NotifyStateChanged to better reflect what it's doing.
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
#include <deque>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/Core.h"
|
||||
#include "VideoCommon/PerformanceTracker.h"
|
||||
|
||||
namespace Core
|
||||
@ -29,6 +30,7 @@ public:
|
||||
|
||||
void CountFrame();
|
||||
void CountVBlank();
|
||||
void OnEmulationStateChanged(Core::State state);
|
||||
|
||||
// Call from CPU thread.
|
||||
void CountThrottleSleep(DT sleep);
|
||||
|
Reference in New Issue
Block a user