Commit 77f01c2
authored
RemovePieSlice - unset m_ActiveSubPieMenu if it's deleted
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.1 parent b5ad2d0 commit 77f01c2
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
406 | 410 | | |
407 | 411 | | |
408 | 412 | | |
| |||
0 commit comments