mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-28 02:55:05 +00:00
core/log: add a mutex to protect stdoutStream
QTextStream is not thread safe.
This commit is contained in:
1 parent
7511545ee2
commit
eb6eaf59c7
2 files changed
+4
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user