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.5
Change-Id: Ifc6471b933fb1b4d1e83e9b734aac31044dce03e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 4dbc267)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8543be7)
  • Loading branch information
torarnv authored and Qt Cherry-pick Bot committed Feb 6, 2024
1 parent 481d4fc commit 2050b40
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 @@ -184,6 +184,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 2050b40

Please sign in to comment.