Fix segfault when closing widget and destroying window in QDialog::done
On OpenSUSE we seem to get an Enter event after or while the QWindow is closed, and that appears to reset the currentMouseWindow after we cleared it in QWindowPrivate::destroy. Apply a workaround similar to the focus_window to make sure that currentMouseWindow and currentMousePressWindow don't point to destroyed objects. Pick-to: 6.2 Change-Id: I61afdaa7d8d1d437058624012319460be2f2567f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
197fcdd7ee
commit
e9e8d67e31
@ -223,11 +223,15 @@ QWindow::~QWindow()
|
|||||||
if (!QGuiApplicationPrivate::is_app_closing)
|
if (!QGuiApplicationPrivate::is_app_closing)
|
||||||
QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
|
QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
|
||||||
|
|
||||||
// focus_window is normally cleared in destroy(), but the window may in
|
// thse are normally cleared in destroy(), but the window may in
|
||||||
// some cases end up becoming the focus window again. Clear it again
|
// some cases end up becoming the focus window again, or receive an enter
|
||||||
// here as a workaround. See QTBUG-75326.
|
// event. Clear it again here as a workaround. See QTBUG-75326.
|
||||||
if (QGuiApplicationPrivate::focus_window == this)
|
if (QGuiApplicationPrivate::focus_window == this)
|
||||||
QGuiApplicationPrivate::focus_window = nullptr;
|
QGuiApplicationPrivate::focus_window = nullptr;
|
||||||
|
if (QGuiApplicationPrivate::currentMouseWindow == this)
|
||||||
|
QGuiApplicationPrivate::currentMouseWindow = nullptr;
|
||||||
|
if (QGuiApplicationPrivate::currentMousePressWindow == this)
|
||||||
|
QGuiApplicationPrivate::currentMousePressWindow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWindowPrivate::init(QScreen *targetScreen)
|
void QWindowPrivate::init(QScreen *targetScreen)
|
||||||
|
Loading…
Reference in New Issue
Block a user