From 5642b6fe7cd84d3fa39d7285e314777cd3c00a4f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 18 Nov 2024 11:09:32 +0100 Subject: [PATCH] Facilitate disabling multi-threading in image manipulation and painting On some platforms and setups, the multi-threaded implementation of this functionality is not desirable. Allow disabling it at runtime by setting the environment variable QT_NO_GUI_THREADPOOL. Task-number: QTBUG-129650 Change-Id: If089ecb3b335defc06f14749841bf9f6041e6f5e Reviewed-by: Eirik Aavitsland (cherry picked from commit 7a8cefd6fb66e6bc6880aaf5a938194611278bed) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/thread/qthreadpool.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 18d4103fdfc..55f13a6b02a 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -481,7 +481,9 @@ QThreadPool *QThreadPoolPrivate::qtGuiInstance() { Q_CONSTINIT static QPointer guiInstance; Q_CONSTINIT static QBasicMutex theMutex; - + const static bool runtime_disable = qEnvironmentVariableIsSet("QT_NO_GUI_THREADPOOL"); + if (runtime_disable) + return nullptr; const QMutexLocker locker(&theMutex); if (guiInstance.isNull() && !QCoreApplication::closingDown()) { guiInstance = new QThreadPool();