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 <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
parent
c08b9a49ba
commit
b216b360ac
@ -178,7 +178,7 @@ QFuture<QPermission::PermissionResult> 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<QPermission::PermissionResult> requestPermissionsInternal(const QStringL
|
||||
array,
|
||||
requestCode);
|
||||
env->DeleteLocalRef(array);
|
||||
}, QJniEnvironment().jniEnv());
|
||||
});
|
||||
|
||||
return future;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ struct Q_CORE_EXPORT QAndroidApplication
|
||||
const QDeadlineTimer
|
||||
&timeout = QDeadlineTimer(-1))
|
||||
{
|
||||
std::function<QVariant()> func = [&](){ runnable(); return QVariant(); };
|
||||
std::function<QVariant()> func = [runnable](){ runnable(); return QVariant(); };
|
||||
return static_cast<QFuture<void>>(runOnAndroidMainThread(func, timeout));
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user