From b216b360acc5b1235ea42981ef6961e3f6e2d4fe Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Thu, 3 Jun 2021 14:07:06 +0300 Subject: [PATCH] Android: Use the new runOnAndroidMainThread() call Remove the [&] capture in runOnAndroidMainThread() for void type. Replace the old private QtAndroidPrivate::runOnAndroidThread() with QAndroidApplication::runOnAndroidMainThread(). Task-number: QTBUG-90501 Change-Id: I41eaf1ea9ee68b22861bf498f12a97a02515cc47 Reviewed-by: Rami Potinkara Reviewed-by: Ville Voutilainen --- src/corelib/kernel/qcoreapplication_android.cpp | 4 ++-- src/corelib/kernel/qcoreapplication_platform.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication_android.cpp b/src/corelib/kernel/qcoreapplication_android.cpp index 096226eafb..d073f19f2a 100644 --- a/src/corelib/kernel/qcoreapplication_android.cpp +++ b/src/corelib/kernel/qcoreapplication_android.cpp @@ -178,7 +178,7 @@ QFuture requestPermissionsInternal(const QStringL QMutexLocker locker(&g_pendingPermissionRequestsMutex); g_pendingPermissionRequests->insert(requestCode, promise); - QtAndroidPrivate::runOnAndroidThread([permissions, requestCode] { + QNativeInterface::QAndroidApplication::runOnAndroidMainThread([permissions, requestCode] { QJniEnvironment env; jclass clazz = env.findClass("java/lang/String"); auto array = env->NewObjectArray(permissions.size(), clazz, nullptr); @@ -192,7 +192,7 @@ QFuture requestPermissionsInternal(const QStringL array, requestCode); env->DeleteLocalRef(array); - }, QJniEnvironment().jniEnv()); + }); return future; } diff --git a/src/corelib/kernel/qcoreapplication_platform.h b/src/corelib/kernel/qcoreapplication_platform.h index c65010faee..76779b438c 100644 --- a/src/corelib/kernel/qcoreapplication_platform.h +++ b/src/corelib/kernel/qcoreapplication_platform.h @@ -78,7 +78,7 @@ struct Q_CORE_EXPORT QAndroidApplication const QDeadlineTimer &timeout = QDeadlineTimer(-1)) { - std::function func = [&](){ runnable(); return QVariant(); }; + std::function func = [runnable](){ runnable(); return QVariant(); }; return static_cast>(runOnAndroidMainThread(func, timeout)); } #endif