Ensure logging locks aren't destroyed too early

* If these static locks are destroyed before other things at shutdown, logging
  may crash. We can just leak them since they should survive until process
  shutdown (where it's fine to leak)
This commit is contained in:
baldurk
2019-09-23 12:02:46 +01:00
parent 38415c2296
commit 7a436e1463
+4 -4
View File
@@ -348,9 +348,9 @@ void rdclog_flush()
void rdclogprint_int(LogType type, const char *fullMsg, const char *msg)
{
static Threading::CriticalSection lock;
static Threading::CriticalSection *lock = new Threading::CriticalSection();
SCOPED_LOCK(lock);
SCOPED_LOCK(*lock);
#if ENABLED(OUTPUT_LOG_TO_DEBUG_OUT)
OSUtility::WriteOutput(OSUtility::Output_DebugMon, fullMsg);
@@ -412,9 +412,9 @@ void rdclog_direct(time_t utcTime, uint32_t pid, LogType type, const char *proje
"Debug ", "Log ", "Warning", "Error ", "Fatal ",
};
static Threading::CriticalSection lock;
static Threading::CriticalSection *lock = new Threading::CriticalSection();
SCOPED_LOCK(lock);
SCOPED_LOCK(*lock);
rdclog_outputBuffer[rdclog_outBufSize] = rdclog_outputBuffer[0] = 0;