iOS: Don't assume screens will not be connected before QIOSIntegration

When an external screen is connected to an iPad, and the application is
starting up on that screen, we will get a connection notification about
that screen as part of the initial bootstrap of UIApplicationMain,
before we call the user's main().

Since we initialize and add all available screen on QIOSIntegration
creation, we can just ignore the early connection notification.

This avoids a crash, but the window will not show anything on the
external screen, which is a separate issue.

Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-106701
Change-Id: I9e0a9736bf602277316bd004e0d01c640feaf319
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-12-15 16:40:34 +01:00
parent 686c02224c
commit dd49793bc3
1 changed files with 2 additions and 2 deletions

View File

@ -73,8 +73,8 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
+ (void)screenConnected:(NSNotification*)notification
{
Q_ASSERT_X(QIOSIntegration::instance(), Q_FUNC_INFO,
"Screen connected before QIOSIntegration creation");
if (!QIOSIntegration::instance())
return; // Will be added when QIOSIntegration is created
QWindowSystemInterface::handleScreenAdded(new QIOSScreen([notification object]));
}