ios: Fix crash when closing app while showing a native screen

Fixes: QTBUG-117021
Change-Id: Icebae0e815b42c6e0bf39e727fd1a16db5752d78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ae83f327cd812c199304159fc9bbd93f4a728fdb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9be520e445a6ab6c2bde84e2552ce2404478bfbb)
This commit is contained in:
Albert Astals Cid 2023-09-12 10:22:27 +02:00 committed by Qt Cherry-pick Bot
parent 4ed95e0cbc
commit 2f04d66ce0

View File

@ -107,8 +107,11 @@
{
Q_UNUSED(subview);
Q_ASSERT(self.window);
UIWindow *uiWindow = self.window;
// uiWindow can be null when closing from the ios "app manager" and the app is
// showing a native window like UIDocumentBrowserViewController
if (!uiWindow)
return;
if (uiWindow.screen != [UIScreen mainScreen] && self.subviews.count == 1) {
// We're about to remove the last view of an external screen, so go back