| @@ -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<std::mutex> lock(APPLICATION->loggerMutex); // synchronized, QFile logFile is not thread-safe | ||||
|  | ||||
|     QString out = qFormatLogMessage(type, context, msg); | ||||
|     out += QChar::LineFeed; | ||||
|  | ||||
|   | ||||
| @@ -45,6 +45,7 @@ | ||||
| #include <QUrl> | ||||
|  | ||||
| #include <BaseInstance.h> | ||||
| #include <mutex> | ||||
|  | ||||
| #include "minecraft/launch/MinecraftServerTarget.h" | ||||
|  | ||||
| @@ -310,4 +311,5 @@ public: | ||||
|     QList<QUrl> m_zipsToImport; | ||||
|     QString m_instanceIdToShowWindowOf; | ||||
|     std::unique_ptr<QFile> logFile; | ||||
|     std::mutex loggerMutex; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 KosmX
					KosmX