diff options
Diffstat (limited to 'indra/llcommon/lltrace.cpp')
-rw-r--r-- | indra/llcommon/lltrace.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index 9cadd70dd8..463048008f 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -30,7 +30,7 @@ #include "lltracethreadrecorder.h" #include "llfasttimer.h" -static bool sInitialized; +static S32 sInitializationCount = 0; namespace LLTrace { @@ -39,19 +39,24 @@ static MasterThreadRecorder* gMasterThreadRecorder = NULL; void init() { - gMasterThreadRecorder = new MasterThreadRecorder(); - sInitialized = true; + if (sInitializationCount++ == 0) + { + gMasterThreadRecorder = new MasterThreadRecorder(); + } } bool isInitialized() { - return sInitialized; + return sInitializationCount > 0; } void cleanup() { - delete gMasterThreadRecorder; - gMasterThreadRecorder = NULL; + if (--sInitializationCount == 0) + { + delete gMasterThreadRecorder; + gMasterThreadRecorder = NULL; + } } MasterThreadRecorder& getMasterThreadRecorder() |