mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10:00
core/log: add a mutex to protect stdoutStream
QTextStream is not thread safe.
This commit is contained in:
parent
7511545ee2
commit
eb6eaf59c7
2 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue