From 6a9ed210792ac60d9ed35cc702500e5ebbb95622 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 11 Aug 2024 19:04:49 -0400 Subject: [PATCH] Prevent long-running threads from deadlocking the program with only 1 CPU * Fixes #10391 --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 6544fa50d..a3e736e20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "cli/Utils.h" @@ -64,6 +65,12 @@ int main(int argc, char** argv) Application::setApplicationVersion(KEEPASSXC_VERSION); app.setProperty("KPXC_QUALIFIED_APPNAME", "org.keepassxc.KeePassXC"); + // HACK: Prevent long-running threads from deadlocking the program with only 1 CPU + // See https://github.com/keepassxreboot/keepassxc/issues/10391 + if (QThreadPool::globalInstance()->maxThreadCount() < 2) { + QThreadPool::globalInstance()->setMaxThreadCount(2); + } + QCommandLineParser parser; parser.setApplicationDescription(QObject::tr("KeePassXC - cross-platform password manager")); parser.addPositionalArgument(