Skip to content

Commit 7c5a6c4

Browse files
committed
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.
1 parent 5bf6a41 commit 7c5a6c4

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/core/logging.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,15 @@ void LogManager::init(
310310
instance->rules->append(parser.rules());
311311
}
312312

313-
qInstallMessageHandler(&LogManager::messageHandler);
314-
315313
instance->lastCategoryFilter = QLoggingCategory::installFilter(&LogManager::filterCategory);
316314

315+
if (instance->lastCategoryFilter == &LogManager::filterCategory) {
316+
qCFatal(logLogging) << "Quickshell's log filter has been installed twice. This is a bug.";
317+
instance->lastCategoryFilter = nullptr;
318+
}
319+
320+
qInstallMessageHandler(&LogManager::messageHandler);
321+
317322
qCDebug(logLogging) << "Creating offthread logger...";
318323
auto* thread = new QThread();
319324
instance->threadProxy.moveToThread(thread);

0 commit comments

Comments
 (0)