From 4dbc267945df841508a217fbdb6faf15c6f457fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 5 Feb 2024 15:22:51 +0100 Subject: [PATCH] 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 --- src/plugins/platforms/ios/qiosscreen.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 65a8c21060c..b54c696f3f3 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -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