bugfix(lan): Fix crash when changing settings in the LAN lobby#2676
bugfix(lan): Fix crash when changing settings in the LAN lobby#2676Caball009 wants to merge 4 commits into
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/GameNetwork/LANGameInfo.h | Adds LANDisableButtons() declaration alongside the pre-existing LANEnableStartButton prototype; minimal, consistent change. |
| Core/GameEngine/Source/GameNetwork/LANAPI.cpp | Calls LANDisableButtons() when m_gameStartSeconds == 1, one update tick before the game-start chain that nulls the GUI pointers; timing analysis confirms no null-deref risk. |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | Implements LANDisableButtons(), disabling all lobby controls that could trigger a crash if clicked after DeinitLanGameGadgets runs; follows the same pattern as LANEnableStartButton. |
Reviews (4): Last reviewed commit: "Tweaked comment." | Re-trigger Greptile
| break; | ||
|
|
||
| LANGameInfo* myGame = TheLAN->GetMyGame(); | ||
| if (myGame->isGameInProgress()) |
There was a problem hiding this comment.
It is very suspicious that the menu can still be interacted with after it was shutdown. Why is this possible? Is there maybe a general issue with menus?
There was a problem hiding this comment.
I don't think this is because of a general issues with menus. The game just nulls the button pointers before it changes the window / takes away control from the user.
Perhaps from user perspective the cleanest solution would be to disable (grey out) the buttons when the timer has zero seconds remaining. I don't know how to access the buttons in the code that has access to the timer, though.
There was a problem hiding this comment.
It would be good if the window is changed or control is taken before the button pointers are nulled. That way no special safe guards need to be placed in multiple handlers.
Is the issue maybe that the handling of a button press is delayed by 1 or multiple frames because of input system updates, and so it can arrive after the menu screen was destroyed? If so, maybe the solution here is to add a condition into every menu input handler and check that the owning menu is still active, and if not, return early and do not handle the input.
There was a problem hiding this comment.
I changed the implementation to disable the buttons when the countdown is at one second remaining.
b23c39e to
beea96f
Compare
This reverts commit 83c3f3b.
0951279 to
c6beb06
Compare
It's currently possible to crash the game with a well-timed option change in the LAN lobby / options menu. The game calls
DeinitLanGameGadgets, which sets a few button pointers tonullptr, when the countdown is somewhere between 1 and game start. If the options are changed after this (but before the game the actually starts), the game crashes because it attempts to dereference the pointers.This PR adds a few checks inThis PR disables the LAN buttons early, before they're deinitialized, to prevent the host from using them at the last moment.LanGameOptionsMenuSystemto ignore such changes.Callstack for
DeinitLanGameGadgets:Callstack for crash (in this case changing the super weapon limit):
TODO: