- explicitly destroy the AltHUD when exiting.

This is to avoid problems with the GC on shutdown.
This commit is contained in:
Christoph Oelckers 2023-01-14 14:09:25 +01:00
parent 6c3d03cd48
commit 1bfccbcb6e
2 changed files with 7 additions and 1 deletions

View file

@ -165,6 +165,7 @@ bool G_Responder(event_t* ev);
void HudScaleChanged(); void HudScaleChanged();
bool M_SetSpecialMenu(FName& menu, int param); bool M_SetSpecialMenu(FName& menu, int param);
void OnMenuOpen(bool makeSound); void OnMenuOpen(bool makeSound);
void DestroyAltHUD();
DStatusBarCore* StatusBar; DStatusBarCore* StatusBar;
@ -622,6 +623,7 @@ int GameMain()
} }
//DeleteScreenJob(); //DeleteScreenJob();
if (gi) gi->FreeLevelData(); if (gi) gi->FreeLevelData();
DestroyAltHUD();
DeinitMenus(); DeinitMenus();
if (StatusBar) StatusBar->Destroy(); if (StatusBar) StatusBar->Destroy();
StatusBar = nullptr; StatusBar = nullptr;

View file

@ -134,14 +134,18 @@ static DObject* DoCreateAltHUD(const FName classname)
return althud; return althud;
} }
void CreateAltHUD() void DestroyAltHUD()
{ {
if (AltHud) if (AltHud)
{ {
AltHud->Destroy(); AltHud->Destroy();
AltHud = nullptr; AltHud = nullptr;
} }
}
void CreateAltHUD()
{
DestroyAltHUD();
/* /*
if (!hud_althud_forceinternal) if (!hud_althud_forceinternal)
AltHud = DoCreateAltHUD(gameinfo.althudclass); AltHud = DoCreateAltHUD(gameinfo.althudclass);