From a000a3c23f4b76b2a62520df96d28607d3cc8dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 19 Jan 2017 22:08:13 +0100 Subject: [PATCH] Only allow reset/power when core is running If we don't check for Core::IsRunning(), event types such as iosNotifyResetButton may actually be nullptr, or some random invalid pointer (after an emulation start then shutdown) and be used when the user triggers a reset, which causes random crashes. --- Source/Core/Core/HW/ProcessorInterface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Core/Core/HW/ProcessorInterface.cpp b/Source/Core/Core/HW/ProcessorInterface.cpp index 47535938fc..2f5ccc9bb5 100644 --- a/Source/Core/Core/HW/ProcessorInterface.cpp +++ b/Source/Core/Core/HW/ProcessorInterface.cpp @@ -230,6 +230,8 @@ static void IOSNotifyPowerButtonCallback(u64 userdata, s64 cyclesLate) void ResetButton_Tap() { + if (!Core::IsRunning()) + return; CoreTiming::ScheduleEvent(0, toggleResetButton, true, CoreTiming::FromThread::ANY); CoreTiming::ScheduleEvent(0, iosNotifyResetButton, 0, CoreTiming::FromThread::ANY); CoreTiming::ScheduleEvent(SystemTimers::GetTicksPerSecond() / 2, toggleResetButton, false, @@ -238,6 +240,8 @@ void ResetButton_Tap() void PowerButton_Tap() { + if (!Core::IsRunning()) + return; CoreTiming::ScheduleEvent(0, iosNotifyPowerButton, 0, CoreTiming::FromThread::ANY); }