RemovePieSlice - unset m_ActiveSubPieMenu if it's deleted#223
Merged
Causeless merged 2 commits intocortex-command-community:developmentfrom Oct 28, 2025
Merged
RemovePieSlice - unset m_ActiveSubPieMenu if it's deleted#223Causeless merged 2 commits intocortex-command-community:developmentfrom
Causeless merged 2 commits intocortex-command-community:developmentfrom
Conversation
Not doing this can cause a crash due to the a sub pie menu being open when its pie slice is removed. For example, having a grenade launcher subpiemenu open when the current actor enters a "dying" state causes it to get detached, removing and clearing the subpiemenu, but not removing it as the active subpiemenu. The game then tries to render it and crashes on `m_LargeFont` being `nullptr`. For example, here's a gdb backtrace to where exactly the submenu gets cleared, and then where the game crashes, before this patch: ``` Thread 1 "CortexCommand" hit Breakpoint 1, RTE::PieMenu::Clear (this=0x5555813c5050) at ../Source/Entities/PieMenu.cpp:55 55 m_LargeFont = nullptr; #0 RTE::PieMenu::Clear (this=0x5555813c5050) at ../Source/Entities/PieMenu.cpp:55 cortex-command-community#1 0x000055555585c4d8 in RTE::PieMenu::Destroy (this=0x5555813c5050, notInherited=true) at ../Source/Entities/PieMenu.cpp:174 cortex-command-community#2 0x0000555555871d24 in RTE::PieSlice::PieMenuCustomDeleter::operator() (this=0x55557eb82ac8, pieMenu=0x5555813c5050) at ../Source/Entities/PieSlice.cpp:191 cortex-command-community#3 0x00005555558728d9 in std::unique_ptr<RTE::PieMenu, RTE::PieSlice::PieMenuCustomDeleter>::~unique_ptr (this=0x55557eb82ac8) at /usr/include/c++/15.2.1/bits/unique_ptr.h:399 cortex-command-community#4 0x000055555586fe6d in RTE::PieSlice::~PieSlice (this=0x55557eb829d0) at ../Source/Entities/PieSlice.cpp:17 cortex-command-community#5 0x000055555586feca in RTE::PieSlice::~PieSlice (this=0x55557eb829d0) at ../Source/Entities/PieSlice.cpp:17 cortex-command-community#6 0x000055555585edfa in RTE::PieMenu::RemovePieSlicesByOriginalSource (this=0x5555825f5de0, originalSource=0x55557062b730) at ../Source/Entities/PieMenu.cpp:459 cortex-command-community#7 0x00005555557b9c96 in RTE::Attachable::AddOrRemovePieSlicesAndListenersFromPieMenu (this=0x55557062b730, pieMenuToModify=0x5555825f5de0, addToPieMenu=false) at ../Source/Entities/Attachable.cpp:609 cortex-command-community#8 0x00005555557b8e64 in RTE::Attachable::SetParent (this=0x55557062b730, newParent=0x0) at ../Source/Entities/Attachable.cpp:541 cortex-command-community#9 0x00005555557f3b3d in RTE::HDFirearm::SetParent (this=0x55557062b730, newParent=0x0) at ../Source/Entities/HDFirearm.h:486 cortex-command-community#10 0x000055555582cf54 in RTE::MOSRotating::RemoveAttachable (this=0x55557119cac0, attachable=0x55557062b730, addToMovableMan=true, addBreakWounds=false) at ../Source/Entities/MOSRotating.cpp:1507 cortex-command-community#11 0x00005555557b8582 in RTE::Attachable::RemoveAttachable (this=0x55557119cac0, attachable=0x55557062b730, addToMovableMan=true, addBreakWounds=false) at ../Source/Entities/Attachable.cpp:466 cortex-command-community#12 0x000055555577d1b4 in RTE::AHuman::Update (this=0x5555717641d0) at ../Source/Entities/AHuman.cpp:2608 cortex-command-community#13 0x0000555555ae03c5 in RTE::MovableMan::Update (this=0x555557405d50) at ../Source/Managers/MovableMan.cpp:1405 cortex-command-community#14 0x000055555567597c in RunGameLoop () at ../Source/Main.cpp:354 cortex-command-community#15 0x000055555567658a in main (argc=1, argv=0x7fffffffdc88) at ../Source/Main.cpp:468 Thread 1 "CortexCommand" received signal SIGSEGV, Segmentation fault. 0x000055555593a220 in RTE::GUIFont::GetFontHeight (this=0x0) at ../Source/GUI/GUIFont.cpp:394 394 return m_FontHeight; ``` I cannot replicate the crash with this patch applied.
Causeless
approved these changes
Oct 28, 2025
01fb6b0
into
cortex-command-community:development
0 of 4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not doing this can cause a crash due to the a sub pie menu being open when its pie slice is removed.
For example, having a grenade launcher subpiemenu open when the current actor enters a "dying" state causes it to get detached, removing and clearing the subpiemenu, but not removing it as the active subpiemenu. The game then tries to render it and crashes on
m_LargeFontbeingnullptr.For example, here's a gdb backtrace to where exactly the submenu gets cleared, and then where the game crashes, before this patch:
Details
Here's the backtrace of a crash from a debug build of the game:
Details
Demonstration of the crash:
tmp.uVp57hVAG6.mp4
I cannot replicate the crash with this patch applied.