core/log: add a mutex to protect stdoutStream

QTextStream is not thread safe.
This commit is contained in:
Dan Aloni authored and outfoxxed committed 2026-03-19 03:36:12 -07:00
1 parent 7511545ee2
commit eb6eaf59c7
2 files changed
+4

No files matched your search

+2
View File
@@ -14,6 +14,7 @@
#include <qlist.h>
#include <qlogging.h>
#include <qloggingcategory.h>
#include <qmutex.h>
#include <qnamespace.h>
#include <qobject.h>
#include <qobjectdefs.h>
@@ -220,6 +221,7 @@ void LogManager::messageHandler(
}
if (display) {
auto locker = QMutexLocker(&self->stdoutMutex);
LogMessage::formatMessage(
self->stdoutStream,
message,
+2
View File
@@ -10,6 +10,7 @@
#include <qlatin1stringview.h>
#include <qlogging.h>
#include <qloggingcategory.h>
#include <qmutex.h>
#include <qobject.h>
#include <qtmetamacros.h>
@@ -135,6 +136,7 @@ private:
QHash<QLatin1StringView, CategoryFilter> allFilters;
QTextStream stdoutStream;
QMutex stdoutMutex;
LoggingThreadProxy threadProxy;
friend void initLogCategoryLevel(const char* name, QtMsgType defaultLevel);