2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00

Fix possible deadlock in debug logs.

This commit is contained in:
John Preston
2021-05-12 14:48:44 +04:00
parent 2d8f43bd8c
commit e7ca35a276
3 changed files with 22 additions and 4 deletions

View File

@@ -420,7 +420,6 @@ void Launcher::prepareSettings() {
void Launcher::initQtMessageLogging() {
static QtMessageHandler OriginalMessageHandler = nullptr;
static bool WritingQtMessage = false;
OriginalMessageHandler = qInstallMessageHandler([](
QtMsgType type,
const QMessageLogContext &context,
@@ -429,10 +428,9 @@ void Launcher::initQtMessageLogging() {
OriginalMessageHandler(type, context, msg);
}
if (Logs::DebugEnabled() || !Logs::started()) {
if (!WritingQtMessage) {
WritingQtMessage = true;
if (!Logs::WritingEntry()) {
// Sometimes Qt logs something inside our own logging.
LOG((msg));
WritingQtMessage = false;
}
}
});