mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-22 11:02:38 +00: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:
parent
8ee64a84c7
commit
bad78cfed4
8 changed files with 25 additions and 20 deletions
|
@ -35,6 +35,12 @@ void PerformanceMetrics::CountVBlank()
|
|||
m_vps_counter.Count();
|
||||
}
|
||||
|
||||
void PerformanceMetrics::OnEmulationStateChanged([[maybe_unused]] Core::State state)
|
||||
{
|
||||
m_fps_counter.InvalidateLastTime();
|
||||
m_vps_counter.InvalidateLastTime();
|
||||
}
|
||||
|
||||
void PerformanceMetrics::CountThrottleSleep(DT sleep)
|
||||
{
|
||||
m_time_sleeping += sleep;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue