GUI: Resolve issue causing a crash when using `Close All Windows` while a game is running

This commit is contained in:
Tyler Wilding 2020-12-10 19:26:26 -05:00 committed by lightningterror
parent 88983caaba
commit 083380297f
2 changed files with 21 additions and 18 deletions

View File

@ -363,7 +363,8 @@ bool AppCorePlugins::OpenPlugin_GS()
void AppCorePlugins::ClosePlugin_GS() void AppCorePlugins::ClosePlugin_GS()
{ {
_parent::ClosePlugin_GS(); _parent::ClosePlugin_GS();
if( GetMTGS().IsSelf() && GSopen2 ) sApp.CloseGsPanel(); if (CloseViewportWithPlugins && GetMTGS().IsSelf() && GSopen2)
sApp.CloseGsPanel();
} }

View File

@ -1024,7 +1024,8 @@ void Pcsx2App::OpenGsPanel()
void Pcsx2App::CloseGsPanel() void Pcsx2App::CloseGsPanel()
{ {
if( AppRpc_TryInvoke( &Pcsx2App::CloseGsPanel ) ) return; if (AppRpc_TryInvoke(&Pcsx2App::CloseGsPanel))
return;
if (CloseViewportWithPlugins) if (CloseViewportWithPlugins)
{ {
@ -1032,17 +1033,12 @@ void Pcsx2App::CloseGsPanel()
if (GSPanel* woot = gsFrame->GetViewport()) if (GSPanel* woot = gsFrame->GetViewport())
woot->Destroy(); woot->Destroy();
} }
#ifndef DISABLE_RECORDING
// Disable recording controls that only make sense if the game is running
sMainFrame.enableRecordingMenuItem(MenuId_Recording_FrameAdvance, false);
sMainFrame.enableRecordingMenuItem(MenuId_Recording_TogglePause, false);
sMainFrame.enableRecordingMenuItem(MenuId_Recording_ToggleRecordingMode, false);
#endif
} }
void Pcsx2App::OnGsFrameClosed(wxWindowID id) void Pcsx2App::OnGsFrameClosed(wxWindowID id)
{ {
if( (m_id_GsFrame == wxID_ANY) || (m_id_GsFrame != id) ) return; if ((m_id_GsFrame == wxID_ANY) || (m_id_GsFrame != id))
return;
CoreThread.Suspend(); CoreThread.Suspend();
@ -1052,6 +1048,12 @@ void Pcsx2App::OnGsFrameClosed( wxWindowID id )
// right now there's no way to resume from suspend without GUI. // right now there's no way to resume from suspend without GUI.
PrepForExit(); PrepForExit();
} }
#ifndef DISABLE_RECORDING
// Disable recording controls that only make sense if the game is running
sMainFrame.enableRecordingMenuItem(MenuId_Recording_FrameAdvance, false);
sMainFrame.enableRecordingMenuItem(MenuId_Recording_TogglePause, false);
sMainFrame.enableRecordingMenuItem(MenuId_Recording_ToggleRecordingMode, false);
#endif
} }
void Pcsx2App::OnProgramLogClosed( wxWindowID id ) void Pcsx2App::OnProgramLogClosed( wxWindowID id )