From 6026a5aa21d1c11a87ce76a18e497b9547213e27 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 11 Nov 2024 14:27:44 +0100 Subject: [PATCH] QIOSFileDialog: present image picker view without 'parent' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QFileDialog::show()/exec() can be called without having any parent at all, so the check for 'winGuard' in authorization callback would prevent image picker from being presented. In the end we don't need this parent and using 'presentationWindow()' instead. Check before asking for authorization that we indeed have/no a parent window. Fixes: QTBUG-130973 Pick-to: 6.8 Change-Id: Ie3ba285dfff82ac3f53245a032e133bc26763883 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosfiledialog.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiosfiledialog.mm b/src/plugins/platforms/ios/qiosfiledialog.mm index cf9580c17e9..dfde7718f6d 100644 --- a/src/plugins/platforms/ios/qiosfiledialog.mm +++ b/src/plugins/platforms/ios/qiosfiledialog.mm @@ -100,7 +100,7 @@ bool QIOSFileDialog::showImagePickerDialog(QWindow *parent) [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { dispatch_async(dispatch_get_main_queue(), ^{ if (status == PHAuthorizationStatusAuthorized) { - if (thisGuard && winGuard) + if (thisGuard && (winGuard || !parent)) thisGuard->showImagePickerDialog_helper(winGuard); } else if (thisGuard) {