winrt: Fix crash when managing multiple top-level windows

When a window gets removed, the active focus window needs to be set to 0
instead of the the current window. Otherwise
QGuiApplicationPrivate::focus_window is set to an invalid pointer and
crashes when dereferenced.

Change-Id: I258b95e447de4cbfb7f19955079c2545a738e03f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Maurice Kalinowski 2016-08-17 14:22:46 +02:00
parent 960a1e3bf3
commit 0f6ace8118

View File

@ -782,7 +782,7 @@ void QWinRTScreen::removeWindow(QWindow *window)
if (!d->visibleWindows.removeAll(window))
return;
if (wasTopWindow)
QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason);
QWindowSystemInterface::handleWindowActivated(Q_NULLPTR, Qt::OtherFocusReason);
handleExpose();
QWindowSystemInterface::flushWindowSystemEvents();
#if _MSC_VER >= 1900 && !defined(QT_NO_DRAGANDDROP)