-
Notifications
You must be signed in to change notification settings - Fork 121
[GEN][ZH] Fix crash on GameEngine shutdown when GameLogic::clearGameData() was not called before #1001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GEN][ZH] Fix crash on GameEngine shutdown when GameLogic::clearGameData() was not called before #1001
Conversation
xezon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Needs to be relicated in Generals.
How often does this crash occur in Replays?
Happens for every replay. |
|
Ah ok so this only happens when exiting the game during a match, which cannot happen in the regular client, but only with Debug features. |
|
Can only happen with the new Replay Simulation |
|
Updated comment and synced with Generals |
xezon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
…ata() was not called before (TheSuperHackers#1001)
Fixes: #995
This fixes a crash when shutting down the GameEngine without calling
TheGameEngine->reset()first. This happens during Replay Simulation (see #923).During normal shutdown in the existing game this cannot happen because shutdown only occurs with the
GameMessage::MSG_CLEAR_GAME_DATAmessage, which callsGameLogic::clearGameData, which in turn callsTheGameEngine->reset()Why does it crash otherwise?
GameEngine has (among others) two subsystems:
TeamFactoryandPlayerList, which it initializes in that order. During shutdown (in opposite order)~TeamFactory()calls~TeamPrototype(), which calls~Team(), which callsThePlayerList->getPlayerCount()(which then will crash because the PlayerList is already destructed).Resetting first fixes this because it clears all the team prototypes in the TeamFactory.
Changing the order of
TeamFactoryandPlayerListwould probably not work because some other dependency would then likely show up. It also would be a scary change that could break other things. I think resetting first is a valid approach to fix these dependencies and to make sure shutdown always works properly.