diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-02-05 16:09:30 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-02-06 01:53:43 +0000 |
commit | 3b6c471f43e7d9597e150e19433cbbc6ecf35266 (patch) | |
tree | 4a0602064581becc8f2e12f8b9a6ee49cb1b7cf1 /src/plugins | |
parent | 449fd984d216f7181149db2834b7c29edf6cd3aa (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.
Fixes: QTBUG-120369
Change-Id: I6a43bb0a4e72d0d1525a7cc33d572ea7477215b3
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit bc7e728fcfd2cfdbff29fa9d1b0f8dae718a0f8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 34e3bdcb5e99dcae07b8c7749faeb798af21233b)
Diffstat (limited to 'src/plugins')
-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 1d682ff897..db72bdfc80 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -90,11 +90,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]; |