Skip to content

Commit

Permalink
Don't put m_pGameEvent into gHud as this will crash on exit
Browse files Browse the repository at this point in the history
* Just let game_event handle it like the rest of the stuff there
  • Loading branch information
nullsystem committed Jun 2, 2024
1 parent 15725ad commit 33accf0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 19 additions & 0 deletions mp/src/game/client/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include <vgui/ISurface.h>
#include "hud_lcd.h"

#ifdef NEO
#include "neo/ui/neo_hud_game_event.h"
#endif

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

Expand Down Expand Up @@ -520,10 +524,25 @@ void CHud::Shutdown( void )

// Deleting hudlist items can result in them being removed from the same hudlist (m_bNeedsRemove).
// So go through and kill the last item until the array is empty.
#ifdef NEO
// NEO JANK (nullsystem): The original while/delete loop didn't even make sense as the size didn't really come
// down on each delete Tail, but somehow worked for them? Anyway doing it this way.
for (int i = 0; i < m_HudList.Count(); ++i)
{
auto *hudPtr = m_HudList.Element(i);
if (dynamic_cast<CNEOHud_GameEvent *>(hudPtr))
{
// NEO JANK (nullsystem): Let CNeoHud_GameEvent handle it itself, otherwise we get crash on exit
continue;
}
delete hudPtr;
}
#else
while ( m_HudList.Size() > 0 )
{
delete m_HudList.Tail();
}
#endif

m_HudList.Purge();
m_bHudTexturesLoaded = false;
Expand Down
1 change: 0 additions & 1 deletion mp/src/game/client/neo/ui/neo_hud_elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ void CNeoHudElements::FreePanelChildren()
m_pFriendlyMarker = NULL;
}

// now that the game event hud is added to gHud, gHud should take care of deleting it itself?
if (m_pGameEvent)
{
m_pGameEvent->DeletePanel();
Expand Down

0 comments on commit 33accf0

Please sign in to comment.