From 50f53b90220707664947f3d1f9468c466398ec31 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Thu, 29 Jul 2021 11:58:04 +0300 Subject: [PATCH] Pass QDeadlineTimer by value in runOnAndroidMainThread() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also change the timer default value to use QDeadlineTimer::Forever. Pick-to: 6.2 Change-Id: Ia6d0101872a5d01b04e146cd9b2f90315cb8eb2e Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcoreapplication_platform.h | 6 ++---- src/corelib/platform/android/qandroidnativeinterface.cpp | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication_platform.h b/src/corelib/kernel/qcoreapplication_platform.h index 76779b438c..b163ccb81c 100644 --- a/src/corelib/kernel/qcoreapplication_platform.h +++ b/src/corelib/kernel/qcoreapplication_platform.h @@ -69,14 +69,12 @@ struct Q_CORE_EXPORT QAndroidApplication #if QT_CONFIG(future) && !defined(QT_NO_QOBJECT) static QFuture runOnAndroidMainThread(const std::function &runnable, - const QDeadlineTimer - &timeout = QDeadlineTimer(-1)); + const QDeadlineTimer timeout = QDeadlineTimer::Forever); template std::enable_if_t && std::is_same_v, void>, QFuture> static runOnAndroidMainThread(const T &runnable, - const QDeadlineTimer - &timeout = QDeadlineTimer(-1)) + const QDeadlineTimer timeout = QDeadlineTimer::Forever) { std::function func = [runnable](){ runnable(); return QVariant(); }; return static_cast>(runOnAndroidMainThread(func, timeout)); diff --git a/src/corelib/platform/android/qandroidnativeinterface.cpp b/src/corelib/platform/android/qandroidnativeinterface.cpp index 185f9c2daa..a3a10091cb 100644 --- a/src/corelib/platform/android/qandroidnativeinterface.cpp +++ b/src/corelib/platform/android/qandroidnativeinterface.cpp @@ -188,7 +188,7 @@ void QNativeInterface::QAndroidApplication::hideSplashScreen(int duration) #if QT_CONFIG(future) && !defined(QT_NO_QOBJECT) QFuture QNativeInterface::QAndroidApplication::runOnAndroidMainThread( const std::function &runnable, - const QDeadlineTimer &timeout) + const QDeadlineTimer timeout) { QSharedPointer> promise(new QPromise()); QFuture future = promise->future();