From f64201c493cda6750da4e50b5112237ae1696d81 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 29 Mar 2021 12:48:16 +0200 Subject: Set QGuiApplicationPrivate variables after platform window is destroyed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By setting these variables after the platform window has been destroyed, it will enable any platform specific code to handle changes in terms of focus and so on before the destruction of the window changes these directly. For example, this will prevent a problem with iOS where it keeps track of the current focus object as the signal indicating that the change to focus will still be emitted. This is before the variable is set to nullptr if there is no parent window. Change-Id: Ie540c10760d06dc62e163ccf6f6edea200b43bbf Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindow.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/gui/kernel/qwindow.cpp') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index d93f43a310..1680a6d0b2 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1972,17 +1972,6 @@ void QWindowPrivate::destroy() } } - if (QGuiApplicationPrivate::focus_window == q) - QGuiApplicationPrivate::focus_window = q->parent(); - if (QGuiApplicationPrivate::currentMouseWindow == q) - QGuiApplicationPrivate::currentMouseWindow = q->parent(); - if (QGuiApplicationPrivate::currentMousePressWindow == q) - QGuiApplicationPrivate::currentMousePressWindow = q->parent(); - - for (int i = 0; i < QGuiApplicationPrivate::tabletDevicePoints.size(); ++i) - if (QGuiApplicationPrivate::tabletDevicePoints.at(i).target == q) - QGuiApplicationPrivate::tabletDevicePoints[i].target = q->parent(); - bool wasVisible = q->isVisible(); visibilityOnDestroy = wasVisible && platformWindow; @@ -2007,6 +1996,17 @@ void QWindowPrivate::destroy() platformWindow = nullptr; delete pw; + if (QGuiApplicationPrivate::focus_window == q) + QGuiApplicationPrivate::focus_window = q->parent(); + if (QGuiApplicationPrivate::currentMouseWindow == q) + QGuiApplicationPrivate::currentMouseWindow = q->parent(); + if (QGuiApplicationPrivate::currentMousePressWindow == q) + QGuiApplicationPrivate::currentMousePressWindow = q->parent(); + + for (int i = 0; i < QGuiApplicationPrivate::tabletDevicePoints.size(); ++i) + if (QGuiApplicationPrivate::tabletDevicePoints.at(i).target == q) + QGuiApplicationPrivate::tabletDevicePoints[i].target = q->parent(); + resizeEventPending = true; receivedExpose = false; exposed = false; -- cgit v1.2.3