From 7b5a7e10a962a9ec57cb7166208c21855b6fc22b Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 8 May 2015 21:42:28 -0400 Subject: [PATCH] fixed log crash at shutdown --- Log.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Log.h b/Log.h index 5fda7b21..ea821954 100644 --- a/Log.h +++ b/Log.h @@ -63,9 +63,10 @@ inline void StartLog (const std::string& fullFilePath) { if (!g_Log) { - g_Log = new Log (); + auto log = new Log (); if (fullFilePath.length () > 0) - g_Log->SetLogFile (fullFilePath); + log->SetLogFile (fullFilePath); + g_Log = log; } } @@ -73,9 +74,10 @@ inline void StartLog (std::ostream * s) { if (!g_Log) { - g_Log = new Log (); + auto log = new Log (); if (s) - g_Log->SetLogStream (s); + log->SetLogStream (s); + g_Log = log; } } @@ -83,8 +85,10 @@ inline void StopLog () { if (g_Log) { - delete g_Log; + auto log = g_Log; g_Log = nullptr; + log->Stop (); + delete log; } }