diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index a122a467e9..300c718d89 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -1053,15 +1053,15 @@ void UpdateInputGate(bool require_focus, bool require_full_focus) } CPUThreadGuard::CPUThreadGuard(Core::System& system) - : m_system(system), m_was_cpu_thread(IsCPUThread()) + : m_system(system), m_was_cpu_thread(IsCPUThread()), m_has_cpu_thread(IsRunningAndStarted()) { - if (!m_was_cpu_thread) - m_was_unpaused = PauseAndLock(system, true, true); + if (m_has_cpu_thread && !m_was_cpu_thread) + m_was_unpaused = PauseAndLock(m_system, true, true); } CPUThreadGuard::~CPUThreadGuard() { - if (!m_was_cpu_thread) + if (m_has_cpu_thread && !m_was_cpu_thread) PauseAndLock(m_system, false, m_was_unpaused); } diff --git a/Source/Core/Core/Core.h b/Source/Core/Core/Core.h index 8ff3b32626..8b4b314268 100644 --- a/Source/Core/Core/Core.h +++ b/Source/Core/Core/Core.h @@ -115,6 +115,7 @@ public: private: Core::System& m_system; const bool m_was_cpu_thread; + const bool m_has_cpu_thread; bool m_was_unpaused = false; };