Skip to content

Commit 0fc66f8

Browse files
committed
Fix use-after-free crash when replay ends in headless mode
1 parent 7af8c63 commit 0fc66f8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,15 @@ void RecorderClass::stopPlayback() {
478478

479479
if (!m_doingAnalysis)
480480
{
481+
// TheSuperHackers @bugfix bobtista 29/01/2026 In headless mode, exit directly to avoid
482+
// use-after-free crash during normal game cleanup. The crash occurs because objects are
483+
// accessed after being freed during TheGameEngine->reset(). Since headless mode has no UI
484+
// and is about to exit anyway, we can safely skip the cleanup and let the OS reclaim resources.
485+
if (TheGlobalData->m_headless)
486+
{
487+
exit(0);
488+
}
489+
481490
TheGameLogic->exitGame();
482491
}
483492
}

0 commit comments

Comments
 (0)