Skip to content

Commit 5359aeb

Browse files
committed
Fix 3 issues: MTA freeze on quit, CEF crash on quit (non-user facing), and 'Quit' closing the game being slow to clear the last frame due to redundant blocking operation.
1 parent cbe79d3 commit 5359aeb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Client/core/CCore.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ CCore::CCore()
121121

122122
m_bIsOfflineMod = false;
123123
m_bQuitOnPulse = false;
124+
m_bIsQuitting = false;
124125
m_bDestroyMessageBox = false;
125126
m_bCursorToggleControls = false;
126127
m_bLastFocused = true;
@@ -1165,7 +1166,12 @@ CWebCoreInterface* CCore::GetWebCore()
11651166
void CCore::DestroyWeb()
11661167
{
11671168
WriteDebugEvent("CCore::DestroyWeb");
1168-
SAFE_DELETE(m_pWebCore);
1169+
// Skip CEF cleanup during quit sequence - TerminateProcess will handle it
1170+
// Doing CefShutdown() here will cause a freeze, and cleanup is unnecessary when terminating
1171+
if (!m_bIsQuitting)
1172+
{
1173+
SAFE_DELETE(m_pWebCore);
1174+
}
11691175
m_WebCoreModule.UnloadModule();
11701176
}
11711177

@@ -1458,6 +1464,7 @@ void CCore::Quit(bool bInstantly)
14581464
{
14591465
if (bInstantly)
14601466
{
1467+
m_bIsQuitting = true; // Skip CEF cleanup to prevent CefShutdown freeze
14611468
AddReportLog(7101, "Core - Quit");
14621469
// Show that we are quiting (for the crash dump filename)
14631470
SetApplicationSettingInt("last-server-ip", 1);

Client/core/CCore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
367367
SString m_strModInstallRoot;
368368

369369
bool m_bQuitOnPulse;
370+
bool m_bIsQuitting;
370371
bool m_bDestroyMessageBox;
371372

372373
bool m_bDoneFrameRateLimit;

0 commit comments

Comments
 (0)