From 1f1d9d6dbae58a928337e126e9d63abeb6927300 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 13 Apr 2023 18:50:50 +0800 Subject: [PATCH] Ensure we are making all file modifications under mutex protection Signed-off-by: Claudio Cambra --- src/libsync/logger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp index 54347f381..42830d32f 100644 --- a/src/libsync/logger.cpp +++ b/src/libsync/logger.cpp @@ -118,12 +118,12 @@ void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString cout << msg << endl; #endif { + QMutexLocker lock(&_mutex); if (_logFile.size() >= MaxLogSizeBytes) { close(); enterNextLogFile(); } - QMutexLocker lock(&_mutex); _crashLogIndex = (_crashLogIndex + 1) % CrashLogSize; _crashLog[_crashLogIndex] = msg;