Skip to content

Commit

Permalink
[qtgui] fix crash when QWindow gets deleted. Fixes JB#42211
Browse files Browse the repository at this point in the history
Earlier crash fix on commit ad9eb80 caused another:
~QWindow() calls destroy() and if
QWindowSystemInterfacePrivate::handleWindowSystemEvent()
does asynchronous processing, QGuiApplicationPrivate::focus_window
will be already deleted at the time focus change gets handled.

Quite likely that focus change signaling isn't really proper with
this, but then again it's not crashing and hasn't been proper earlier
either.
  • Loading branch information
pvuorela committed Jun 27, 2018
1 parent 11c8f00 commit 9399340
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gui/kernel/qwindow.cpp
Expand Up @@ -203,6 +203,8 @@ QWindow::QWindow(QWindowPrivate &dd, QWindow *parent)
QWindow::~QWindow()
{
destroy();
if (QGuiApplicationPrivate::focus_window == this)
QGuiApplicationPrivate::focus_window = 0;
QGuiApplicationPrivate::window_list.removeAll(this);
if (!QGuiApplicationPrivate::is_app_closing)
QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
Expand Down

0 comments on commit 9399340

Please sign in to comment.