Skip to content

Commit 72823a9

Browse files
committed
Add shutdown flag to prevent streaming during client shutdown
1 parent eca89c1 commit 72823a9

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Client/mods/deathmatch/CClient.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ CGame* g_pGame = NULL;
2020
CMultiplayer* g_pMultiplayer = NULL;
2121
CNet* g_pNet = NULL;
2222
CClientGame* g_pClientGame = NULL;
23+
bool g_bClientShuttingDown = false;
2324

2425
int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)
2526
{
@@ -183,6 +184,9 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)
183184

184185
void CClient::ClientShutdown()
185186
{
187+
// Global shutdown flag
188+
g_bClientShuttingDown = true;
189+
186190
// Unbind our radio controls
187191
g_pCore->GetKeyBinds()->RemoveControlFunction("radio_next", CClientGame::HandleRadioNext);
188192
g_pCore->GetKeyBinds()->RemoveControlFunction("radio_previous", CClientGame::HandleRadioPrevious);

Client/mods/deathmatch/CClient.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include <core/CClientBase.h>
1515

16+
extern bool g_bClientShuttingDown;
17+
1618
class CClient : public CClientBase
1719
{
1820
public:

Client/mods/deathmatch/logic/CClientIMG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool CClientIMG::StreamEnable()
175175
bool CClientIMG::StreamDisable()
176176
{
177177
// If game is shutting down or not streaming is not available, do nothing
178-
if (!g_pClientGame || !g_pGame || !g_pGame->GetStreaming())
178+
if (g_bClientShuttingDown || !IsStreamed())
179179
return false;
180180

181181
// Unlink all models

0 commit comments

Comments
 (0)