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 <eirik.aavitsland@qt.io>
(cherry picked from commit 7a8cefd6fb66e6bc6880aaf5a938194611278bed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Allan Sandfeld Jensen 2024-11-18 11:09:32 +01:00 committed by Qt Cherry-pick Bot
parent 23a4952357
commit 5642b6fe7c

View File

@ -481,7 +481,9 @@ QThreadPool *QThreadPoolPrivate::qtGuiInstance()
{
Q_CONSTINIT static QPointer<QThreadPool> 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();