Skip to content

Conversation

@xezon
Copy link

@xezon xezon commented May 29, 2025

This change fixes a game crash when exiting Replay playback while a player places a beacon.

The null crash does occur in GameLogic::logicMessageDispatcher, but the root cause of the problem already starts earlier.

The RecorderClass can still push replay commands to the CommandList before the final MSG_CLEAR_GAME_DATA is processed in the same frame. MSG_CLEAR_GAME_DATA will destroy the match session.

Callstack for when MSG_CLEAR_GAME_DATA is processed

 	generalszh.exe!GameLogic::reset() Line 453	C++
 	generalszh.exe!SubsystemInterfaceList::resetAll() Line 188	C++
 	[Inline Frame] generalszh.exe!GameLogic::isInMultiplayerGame() Line 418	C++
 	generalszh.exe!GameEngine::reset() Line 699	C++
 	generalszh.exe!GameLogic::clearGameData(bool showScoreScreen) Line 281	C++
 	generalszh.exe!GameLogic::logicMessageDispatcher(GameMessage * msg, void * userData) Line 464	C++
>	generalszh.exe!GameLogic::processCommandList(CommandList * list) Line 2594	C++
 	generalszh.exe!GameLogic::update() Line 3764	C++
 	generalszh.exe!Win32GameEngine::update() Line 93	C++
 	generalszh.exe!GameEngine::execute() Line 819	C++
 	generalszh.exe!GameMain(int argc, char * * argv) Line 47	C++
 	generalszh.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 988	C++
 	[Inline Frame] generalszh.exe!invoke_main() Line 102	C++
 	generalszh.exe!__scrt_common_main_seh() Line 288	C++
 	kernel32.dll!764cfcc9()	Unknown
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ntdll.dll!77ca82ae()	Unknown
 	ntdll.dll!77ca827e()	Unknown

Code for when MSG_PLACE_BEACON is appended, MSG_CLEAR_GAME_DATA is processed

void GameLogic::update( void )
{
...
  // Update the Recorder
  {
    TheRecorder->UPDATE(); // <--- Pushes MSG_PLACE_BEACON in the last frame
  }

  // process client commands
  {
    processCommandList( TheCommandList ); // <--- Processes MSG_CLEAR_GAME_DATA, calls GameLogic::reset() which deletes all things, then processes MSG_PLACE_BEACON, then crashes the game
  }
...
}

Solution

Stop appending Replay commands after MSG_CLEAR_GAME_DATA command was appended.

@xezon xezon added this to the Stability fixes milestone May 29, 2025
@xezon xezon added Bug Something is not working right, typically is user facing Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Crash This is a crash, very bad labels May 29, 2025
@xezon xezon requested a review from Skyaero42 May 29, 2025 18:52
@xezon xezon merged commit de85be4 into TheSuperHackers:main Jun 1, 2025
18 checks passed
@xezon xezon deleted the xezon/fix-replay-beacon-crash-2 branch June 1, 2025 13:15
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Crash This is a crash, very bad Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Game crashes when exiting Replay Mode while player places beacon

4 participants