From 991b5dfe8ca5bbd1e0204c864636307e67b6fa75 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 22 Dec 2022 11:58:17 +0100 Subject: [PATCH] runOnAndroidMainThread(): Use QThreadPool::start() instead of QtConcurrent::run() The latter is in a module (QtConcurrent) that depends on QtCore. Don't make QtCore depend on QtConcurrent... The code doesn't use the QFuture returned from QtConcurrent::run(), anyway, so QThreadPool::start(function) is more than an adequate replacement. Task-number: QTBUG-109586 Change-Id: Id00a42525c3d7454a1fa2d4812de634dbbea1035 Reviewed-by: Qt CI Bot Reviewed-by: Assam Boudjelthia (cherry picked from commit 500e161987af24e2e10d46011d776258d5c0e47a) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/platform/android/qandroidnativeinterface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/platform/android/qandroidnativeinterface.cpp b/src/corelib/platform/android/qandroidnativeinterface.cpp index 6fb6bceadf7..f9e96cf9a83 100644 --- a/src/corelib/platform/android/qandroidnativeinterface.cpp +++ b/src/corelib/platform/android/qandroidnativeinterface.cpp @@ -7,8 +7,10 @@ #include #include #if QT_CONFIG(future) && !defined(QT_NO_QOBJECT) -#include +#include +#include #include +#include #include #endif @@ -160,7 +162,7 @@ QFuture QNativeInterface::QAndroidApplication::runOnAndroidMainThread( promise->start(); if (!timeout.isForever()) { - (void) QtConcurrent::run([=, &future]() { + QThreadPool::globalInstance()->start([=, &future]() { QEventLoop loop; QTimer::singleShot(timeout.remainingTime(), &loop, [&]() { future.cancel();