From 7c5a6c4bd4be1f258aa47626cf5cde02215adad2 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Mon, 6 Apr 2026 00:45:26 -0700 Subject: [PATCH] core/log: crash if Quickshell's log filter is installed twice Crashes from recursion inside filterCategories through the old filter have been observed. Presumably this means the log filter is getting installed twice somehow. This should catch it. --- src/core/logging.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/logging.cpp b/src/core/logging.cpp index 415cf61..1b19fab 100644 --- a/src/core/logging.cpp +++ b/src/core/logging.cpp @@ -310,10 +310,15 @@ void LogManager::init( instance->rules->append(parser.rules()); } - qInstallMessageHandler(&LogManager::messageHandler); - instance->lastCategoryFilter = QLoggingCategory::installFilter(&LogManager::filterCategory); + if (instance->lastCategoryFilter == &LogManager::filterCategory) { + qCFatal(logLogging) << "Quickshell's log filter has been installed twice. This is a bug."; + instance->lastCategoryFilter = nullptr; + } + + qInstallMessageHandler(&LogManager::messageHandler); + qCDebug(logLogging) << "Creating offthread logger..."; auto* thread = new QThread(); instance->threadProxy.moveToThread(thread);