commit requested change, make the lock static
Signed-off-by: KosmX <kosmx.mc@gmail.com>
This commit is contained in:
parent
ec5bb944b2
commit
35a62d9787
@ -77,6 +77,7 @@
|
|||||||
#include "ApplicationMessage.h"
|
#include "ApplicationMessage.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#include <QAccessible>
|
#include <QAccessible>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
@ -150,7 +151,8 @@ namespace {
|
|||||||
/** This is used so that we can output to the log file in addition to the CLI. */
|
/** This is used so that we can output to the log file in addition to the CLI. */
|
||||||
void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||||
{
|
{
|
||||||
const std::lock_guard<std::mutex> lock(APPLICATION->loggerMutex); // synchronized, QFile logFile is not thread-safe
|
static std::mutex loggerMutex;
|
||||||
|
const std::lock_guard<std::mutex> lock(loggerMutex); // synchronized, QFile logFile is not thread-safe
|
||||||
|
|
||||||
QString out = qFormatLogMessage(type, context, msg);
|
QString out = qFormatLogMessage(type, context, msg);
|
||||||
out += QChar::LineFeed;
|
out += QChar::LineFeed;
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include <BaseInstance.h>
|
#include <BaseInstance.h>
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
#include "minecraft/launch/MinecraftServerTarget.h"
|
#include "minecraft/launch/MinecraftServerTarget.h"
|
||||||
|
|
||||||
@ -311,5 +310,4 @@ public:
|
|||||||
QList<QUrl> m_zipsToImport;
|
QList<QUrl> m_zipsToImport;
|
||||||
QString m_instanceIdToShowWindowOf;
|
QString m_instanceIdToShowWindowOf;
|
||||||
std::unique_ptr<QFile> logFile;
|
std::unique_ptr<QFile> logFile;
|
||||||
std::mutex loggerMutex;
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user