iOS: Guard traitCollectionDidChange against lack of QGuiApplication

During shutdown we may get traitCollectionDidChange for our QUIWindow,
as it may outlive the QGuiApplication and the QWindows due to hanging
around in an auto-release pool.

Pick-to: 6.7 6.6 6.5
Change-Id: Ifc6471b933fb1b4d1e83e9b734aac31044dce03e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Tor Arne Vestbø 2024-02-05 15:22:51 +01:00
parent 483523ad9f
commit 4dbc267945
1 changed files with 3 additions and 0 deletions

View File

@ -186,6 +186,9 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
{
[super traitCollectionDidChange:previousTraitCollection];
if (!qGuiApp)
return;
Qt::ColorScheme colorScheme = self.traitCollection.userInterfaceStyle
== UIUserInterfaceStyleDark
? Qt::ColorScheme::Dark