Skip to content

Commit

Permalink
Addendum to f0ddc00
Browse files Browse the repository at this point in the history
Fixed a crash upon server exit if there was no CPerfStatManager created
before stopping
  • Loading branch information
sbx320 committed Aug 13, 2015
1 parent 4f44ffb commit f92f501
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MTA10_Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ CGame::~CGame ( void )
m_bBeingDeleted = true;

// Stop the performance stats modules
CPerfStatManager::GetSingleton ()->Stop ();
if ( CPerfStatManager::GetSingleton () != nullptr )
CPerfStatManager::GetSingleton ()->Stop ();

// Stop and flush sim packet handling
CSimControl::EnableSimSystem ( false );
Expand Down
4 changes: 4 additions & 0 deletions MTA10_Server/mods/deathmatch/logic/CPerfStatManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ static std::unique_ptr<CPerfStatManagerImpl> g_pPerfStatManagerImp;

CPerfStatManager* CPerfStatManager::GetSingleton ( void )
{
// If we're stopping the server, do not create a PerfStatManager just to destroy it
if ( g_pGame->IsBeingDeleted () )
return nullptr;

if ( !g_pPerfStatManagerImp )
g_pPerfStatManagerImp.reset(new CPerfStatManagerImpl ());
return g_pPerfStatManagerImp.get();
Expand Down

0 comments on commit f92f501

Please sign in to comment.