diff options
author | Tor Arne Vestbø <[email protected]> | 2025-07-02 14:20:26 +0200 |
---|---|---|
committer | Tor Arne Vestbø <[email protected]> | 2025-07-10 06:42:06 +0200 |
commit | 5ed1225bd46d68cd0cc51db510ecd808c0136d4a (patch) | |
tree | 60cc89a34d3e8a46dce3f284b5ad8f10e248ab11 | |
parent | dafea19d016f462dd7a7034041610aac15267846 (diff) |
iOS: Release UIWindow when scene disconnects
Scenes may be connected and disconnected, for example when a window is
moved from one screen to another. We were failing to clean up our
window, causing leaks. We now track it using the optional window
property of the UIWindowSceneDelegate protocol.
Pick-to: 6.10 6.9 6.8
Change-Id: I7d564926aa31982fd8178b21e10a14cf614c406d
Reviewed-by: Morten Johan Sørvig <[email protected]>
-rw-r--r-- | src/plugins/platforms/ios/qiosapplicationdelegate.mm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index 722e91c0186..a01c590bba8 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -16,6 +16,7 @@ #include <QtCore/QtCore> @interface QIOSWindowSceneDelegate : NSObject<UIWindowSceneDelegate> +@property (nullable, nonatomic, strong) UIWindow *window; @end @implementation QIOSApplicationDelegate @@ -86,6 +87,14 @@ window.rootViewController = [[[QIOSViewController alloc] initWithWindow:window andScreen:screen] autorelease]; + + self.window = [window autorelease]; +} + +- (void)sceneDidDisconnect:(UIScene *)scene +{ + qCDebug(lcQpaWindowScene) << "Disconnecting" << scene; + self.window = nil; } - (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts |