Skip to content

Commit 2a9bfd7

Browse files
Synchronize changes from 1.6 master branch [ci skip]
4ca27f5 Fix img crash when game shutting down (#4551) f2d2cc3 Visual Studio Update 6855e41 Update client en_US pot
2 parents 29bc99e + 4ca27f5 commit 2a9bfd7

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
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/CClientGame.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6851,6 +6851,10 @@ bool CClientGame::RestreamModel(std::uint16_t model)
68516851

68526852
void CClientGame::RestreamWorld()
68536853
{
6854+
// If game is shutting down, do nothing for avoid crashes
6855+
if (g_bClientShuttingDown)
6856+
return;
6857+
68546858
unsigned int numberOfFileIDs = g_pGame->GetCountOfAllFileIDs();
68556859

68566860
for (unsigned int uiModelID = 0; uiModelID < numberOfFileIDs; uiModelID++)

0 commit comments

Comments
 (0)