summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2019-05-22 14:01:41 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-05-22 12:08:55 +0000
commit1eac947ce2c1d63bd04a94939c4f04e9086913c7 (patch)
treedd3969c28ccb5081a649be2e1e6a40113ed04b9f /src/gui/kernel
parenta67b25067ee78e0c2bc4e77a4c61af43528d9bc2 (diff)
Work around crash where a destroyed window becomes focus_window
Clear QGuiApplication::focus_window (again) in the QWindow destructor. Task-number: QTBUG-75326 Change-Id: Ief00b6adfb267fcc7e3881fd728e12df07fc1094 Reviewed-by: Christian Andersen <csandersen3@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwindow.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index bcd8351619..a19df4da0f 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -218,6 +218,12 @@ QWindow::~QWindow()
QGuiApplicationPrivate::window_list.removeAll(this);
if (!QGuiApplicationPrivate::is_app_closing)
QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
+
+ // focus_window is normally cleared in destroy(), but the window may in
+ // some cases end up becoming the focus window again. Clear it again
+ // here as a workaround. See QTBUG-75326.
+ if (QGuiApplicationPrivate::focus_window == this)
+ QGuiApplicationPrivate::focus_window = 0;
}
void QWindowPrivate::init(QScreen *targetScreen)