QAndroidExtras: release mutex earlier in requestPermissionsInternal()

The g_pendingPermissionRequestsMutex protects only the
g_pendingPermissionRequests QHash, so we can drop it immediately after
the QHash::insert() call. In particular, we don't use reference into
the QHash afterwards, and the following runOnAndroidMainThread() call
is internally synchronized, anyway.

Change-Id: I66a0e402e9ed1edb5fd9fec14e85f9371cc4fc36
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
bb10
Marc Mutz 2022-12-28 15:09:52 +01:00
parent 7e7bae35f7
commit 080e1b6011
1 changed files with 1 additions and 0 deletions

View File

@ -1106,6 +1106,7 @@ requestPermissionsInternal(const QStringList &permissions)
const int requestCode = nextRequestCode();
QMutexLocker locker(&g_pendingPermissionRequestsMutex);
g_pendingPermissionRequests->insert(requestCode, promise);
locker.unlock();
QNativeInterface::QAndroidApplication::runOnAndroidMainThread([permissions, requestCode] {
QJniEnvironment env;