From 1e84b001262da590acd685ef3bd5d522b5992531 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Wed, 16 Jun 2021 13:39:58 +0200 Subject: [PATCH] mtgs: comment the waitforopen reasoning + add closepanel --- pcsx2/MTGS.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index 766f76004e..49955e1a08 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -601,6 +601,7 @@ void SysMtgsThread::CloseGS() void SysMtgsThread::OnSuspendInThread() { GSclose(); + sApp.CloseGsPanel(); GetSysExecutorThread().PostEvent(new SysExecEvent_InvokeMtgsThreadMethod(&SysMtgsThread::CloseGS)); _parent::OnSuspendInThread(); } @@ -925,8 +926,12 @@ void SysMtgsThread::WaitForOpen() void SysMtgsThread::Freeze(int mode, MTGS_FreezeData& data) { Resume(); - WaitForOpen(); SendPointerPacket(GS_RINGTYPE_FREEZE, mode, &data); Resume(); + // we are forced to wait for the semaphore to be released, otherwise + // we'll end up in a state where the main thread is stuck on WaitGS + // and MTGS stuck on sApp.OpenGSPanel, which post an event to the main + // thread. Obviously this ends up in a deadlock. -- govanify + WaitForOpen(); WaitGS(); }