diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 387f735c..ae7a69c6 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -150,6 +150,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 lock(APPLICATION->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 1b3dc499..caee074d 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -45,6 +45,7 @@ #include #include +#include #include "minecraft/launch/MinecraftServerTarget.h" @@ -310,4 +311,5 @@ public: QList m_zipsToImport; QString m_instanceIdToShowWindowOf; std::unique_ptr logFile; + std::mutex loggerMutex; };