Ensure we are making all file modifications under mutex protection

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-04-13 18:50:50 +08:00 committed by Matthieu Gallien
parent 711359ef43
commit 1f1d9d6dba

View file

@ -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;