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()
{
_parent::ClosePlugin_GS();
if( GetMTGS().IsSelf() && GSopen2 ) sApp.CloseGsPanel();
if (CloseViewportWithPlugins && GetMTGS().IsSelf() && GSopen2)
sApp.CloseGsPanel();
}

View File

@ -1024,13 +1024,29 @@ void Pcsx2App::OpenGsPanel()
void Pcsx2App::CloseGsPanel()
{
if( AppRpc_TryInvoke( &Pcsx2App::CloseGsPanel ) ) return;
if (AppRpc_TryInvoke(&Pcsx2App::CloseGsPanel))
return;
if (CloseViewportWithPlugins)
{
if (GSFrame* gsFrame = GetGsFramePtr())
if (GSPanel* woot = gsFrame->GetViewport())
woot->Destroy();
if (GSPanel* woot = gsFrame->GetViewport())
woot->Destroy();
}
}
void Pcsx2App::OnGsFrameClosed(wxWindowID id)
{
if ((m_id_GsFrame == wxID_ANY) || (m_id_GsFrame != id))
return;
CoreThread.Suspend();
if (!m_UseGUI)
{
// The user is prompted before suspending (at Sys_Suspend() ), because
// right now there's no way to resume from suspend without GUI.
PrepForExit();
}
#ifndef DISABLE_RECORDING
// Disable recording controls that only make sense if the game is running
@ -1040,20 +1056,6 @@ void Pcsx2App::CloseGsPanel()
#endif
}
void Pcsx2App::OnGsFrameClosed( wxWindowID id )
{
if( (m_id_GsFrame == wxID_ANY) || (m_id_GsFrame != id) ) return;
CoreThread.Suspend();
if( !m_UseGUI )
{
// The user is prompted before suspending (at Sys_Suspend() ), because
// right now there's no way to resume from suspend without GUI.
PrepForExit();
}
}
void Pcsx2App::OnProgramLogClosed( wxWindowID id )
{
if( (m_id_ProgramLogBox == wxID_ANY) || (m_id_ProgramLogBox != id) ) return;