Debugger: Fixed deadlock when using power off while script window is active

This commit is contained in:
Sour 2019-10-22 18:47:49 -04:00
parent fa98a0ff4e
commit d2463c6c2f
4 changed files with 10 additions and 9 deletions

View file

@ -194,6 +194,8 @@ void Console::Stop(bool sendNotification)
{
_stopFlag = true;
_notificationManager->SendNotification(ConsoleNotificationType::BeforeGameUnload);
shared_ptr<Debugger> debugger = _debugger;
if(debugger) {
debugger->SuspendDebugger(false);
@ -212,8 +214,6 @@ void Console::Stop(bool sendNotification)
_saveStateManager->SaveRecentGame(romInfo.RomFile.GetFileName(), romInfo.RomFile, romInfo.PatchFile);
}
_notificationManager->SendNotification(ConsoleNotificationType::BeforeGameUnload);
if(sendNotification) {
_notificationManager->SendNotification(ConsoleNotificationType::BeforeEmulationStop);
}

View file

@ -8,7 +8,6 @@ enum class ConsoleNotificationType
GameReset = 2,
GamePaused = 3,
GameResumed = 4,
GameStopped = 5,
CodeBreak = 6,
PpuFrameDone = 7,
ResolutionChanged = 8,

View file

@ -143,11 +143,14 @@ namespace Mesen.GUI.Debugger
private void _notifListener_OnNotification(NotificationEventArgs e)
{
if(e.NotificationType == ConsoleNotificationType.GameStopped) {
this._scriptId = -1;
this.BeginInvoke((Action)(() => {
lblScriptActive.Visible = false;
}));
switch(e.NotificationType) {
case ConsoleNotificationType.BeforeGameUnload:
case ConsoleNotificationType.GameLoaded:
this._scriptId = -1;
this.BeginInvoke((Action)(() => {
lblScriptActive.Visible = false;
}));
break;
}
}

View file

@ -52,7 +52,6 @@ namespace Mesen.GUI
GameReset = 2,
GamePaused = 3,
GameResumed = 4,
GameStopped = 5,
CodeBreak = 6,
PpuFrameDone = 7,
ResolutionChanged = 8,