Skip to content

Commit

Permalink
iOS: Guard traitCollectionDidChange against lack of QGuiApplication
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
torarnv committed Feb 5, 2024
1 parent 483523a commit 4dbc267
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/plugins/platforms/ios/qiosscreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
{
[super traitCollectionDidChange:previousTraitCollection];

if (!qGuiApp)
return;

Qt::ColorScheme colorScheme = self.traitCollection.userInterfaceStyle
== UIUserInterfaceStyleDark
? Qt::ColorScheme::Dark
Expand Down

0 comments on commit 4dbc267

Please sign in to comment.