diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-02-05 16:09:30 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-02-05 21:42:48 +0100 |
commit | bc7e728fcfd2cfdbff29fa9d1b0f8dae718a0f8c (patch) | |
tree | 9af49ac5c2a524243c4ad39da46fea1c3ea16487 /src/plugins/platforms | |
parent | 972bd4ed46be6ad905f2cd8bd84776cf3f1f3220 (diff) |
iOS: Remove QUIView from superview on QIOSWindow destruction
Unlike on macOS, our UIViews are children of a QIOSDesktopManagerView
that we use to do window management, so we need to remove the view
from its superview, even if represents a top level QWindow.
The only exception is top level foreign windows, which are used to
represent a native UIView for the purpose of containing a Qt view
hierarchy within. As we don't know anything about the foreign view's
superview hiearchy we shouldn't touch it.
Pick-to: 6.7 6.6
Fixes: QTBUG-120369
Change-Id: I6a43bb0a4e72d0d1525a7cc33d572ea7477215b3
Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index c7469315af..347c7b9df1 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -92,11 +92,12 @@ QIOSWindow::~QIOSWindow() clearAccessibleCache(); - quiview_cast(m_view).platformWindow = 0; + quiview_cast(m_view).platformWindow = nullptr; - // Remove from superview only if we have a Qt window parent, - // as we don't want to affect window container foreign windows. - if (QPlatformWindow::parent()) + // Remove from superview, unless we're a foreign window without a + // Qt window parent, in which case the foreign window is used as + // a window container for a Qt UI hierarchy inside a native UI. + if (!(isForeignWindow() && !QPlatformWindow::parent())) [m_view removeFromSuperview]; [m_view release]; |