From d62c5fda471f3e3c8584f03b44cb4dedd4380412 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 9 Sep 2023 04:44:21 +0300 Subject: [PATCH] game_shared: workaround crash on exit (caused by GoldSrc dlclosing client before initializing it) --- game_shared/voice_status.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/game_shared/voice_status.cpp b/game_shared/voice_status.cpp index 42454ac..a31a383 100644 --- a/game_shared/voice_status.cpp +++ b/game_shared/voice_status.cpp @@ -129,6 +129,8 @@ CVoiceStatus::CVoiceStatus() m_bTalking = m_bServerAcked = false; + // a1ba: should be safe, it's a simple type + memset(m_Labels, 0, sizeof(m_Labels)); memset(m_pBanButtons, 0, sizeof(m_pBanButtons)); m_bServerModEnable = -1; @@ -138,7 +140,7 @@ CVoiceStatus::CVoiceStatus() CVoiceStatus::~CVoiceStatus() { g_pInternalVoiceStatus = NULL; - + for(int i=0; i < MAX_VOICE_SPEAKERS; i++) { delete m_Labels[i].m_pLabel; @@ -146,17 +148,17 @@ CVoiceStatus::~CVoiceStatus() delete m_Labels[i].m_pIcon; m_Labels[i].m_pIcon = NULL; - + delete m_Labels[i].m_pBackground; m_Labels[i].m_pBackground = NULL; - } + } delete m_pLocalLabel; m_pLocalLabel = NULL; FreeBitmaps(); - if(gEngfuncs.pfnGetGameDirectory()) + if(gEngfuncs.pfnGetGameDirectory && gEngfuncs.pfnGetGameDirectory()) { if(m_bBanMgrInitialized) {