aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorKosmX <kosmx.mc@gmail.com>2023-02-01 23:31:12 +0100
committerKosmX <kosmx.mc@gmail.com>2023-02-01 23:31:12 +0100
commit35a62d97875360132d8d67c0e6e6d69dd48481f5 (patch)
treea18988d2dc80f767dacd695ef1f71b10ce00d68e /launcher
parentec5bb944b24413c1dee30a2a8429f484231c60c1 (diff)
downloadPrismLauncher-35a62d97875360132d8d67c0e6e6d69dd48481f5.tar.gz
PrismLauncher-35a62d97875360132d8d67c0e6e6d69dd48481f5.tar.bz2
PrismLauncher-35a62d97875360132d8d67c0e6e6d69dd48481f5.zip
commit requested change, make the lock static
Signed-off-by: KosmX <kosmx.mc@gmail.com>
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp4
-rw-r--r--launcher/Application.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index ae7a69c6..0d3b086f 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -77,6 +77,7 @@
#include "ApplicationMessage.h"
#include <iostream>
+#include <mutex>
#include <QAccessible>
#include <QCommandLineParser>
@@ -150,7 +151,8 @@ namespace {
/** 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)
{
- 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);
out += QChar::LineFeed;
diff --git a/launcher/Application.h b/launcher/Application.h
index caee074d..1b3dc499 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -45,7 +45,6 @@
#include <QUrl>
#include <BaseInstance.h>
-#include <mutex>
#include "minecraft/launch/MinecraftServerTarget.h"
@@ -311,5 +310,4 @@ public:
QList<QUrl> m_zipsToImport;
QString m_instanceIdToShowWindowOf;
std::unique_ptr<QFile> logFile;
- std::mutex loggerMutex;
};