From 080e1b6011ae8b05de4cb03fcdaca4172e5ea8c2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 28 Dec 2022 15:09:52 +0100 Subject: [PATCH] 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 --- src/corelib/platform/android/qandroidextras.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/platform/android/qandroidextras.cpp b/src/corelib/platform/android/qandroidextras.cpp index 7499a6ac81..e5f891e472 100644 --- a/src/corelib/platform/android/qandroidextras.cpp +++ b/src/corelib/platform/android/qandroidextras.cpp @@ -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;