diff options
author | Andy Shaw <andy.shaw@qt.io> | 2021-03-29 12:48:16 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2021-04-08 14:27:57 +0200 |
commit | f64201c493cda6750da4e50b5112237ae1696d81 (patch) | |
tree | c421da638981697cab62ca8f0ba17120807aba1b /src/gui | |
parent | f27b914e79eb0bde4028bf5a9a6bafd5b4fa599d (diff) |
Set QGuiApplicationPrivate variables after platform window is destroyed
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ø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
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; |