qt5base-lts/tests/auto/widgets/dialogs
Mitch Curtis c25ad981a3 QWidgetWindow: don't give focus to windows that are being destroyed
In the referenced bug report, dismissing a QFileDialog while the
Qt Virtual Keyboard was in use would result in a crash.

Dismissing a file dialog created with
e.g. QFileDialog::getOpenFileName() causes it to eventually be
destroyed. When this happens, it starts deleting its children. Each
child widget's destructor calls clearFocus(). In clearFocus(), there is
a block of code that emits QWindow::focusChanged(), passing the result
of focusObject() called on that widget's window.
QWidgetWindow::focusObject() could end up using itself as a fallback
focus object if it had no other focus objects (e.g. children) to use
instead, even though it was in the process of being destroyed; as were
all of its children. The Qt Virtual Keyboard plugin would then try to
use the focus object, even though it was in an invalid state.

To fix this problem, we return early from QWidgetWindow::focusObject()
if the window is in the process of being destroyed.

Task-number: QTBUG-57193
Change-Id: I137cf9415812ce2e0419c0afe8076ce150f248cb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-05-30 10:49:36 +00:00
..
qcolordialog Updated license headers 2016-01-21 18:55:18 +00:00
qdialog QtWidgets: Remove Windows CE. 2016-04-07 10:24:45 +00:00
qerrormessage Updated license headers 2016-01-21 18:55:18 +00:00
qfiledialog QWidgetWindow: don't give focus to windows that are being destroyed 2017-05-30 10:49:36 +00:00
qfiledialog2 Windows: Fix tst_QFileDialog2::completionOnLevelAfterRoot() 2017-04-29 07:39:09 +00:00
qfilesystemmodel tests/auto/widgets: use QCOMPARE(., nullptr) 2016-11-30 07:24:47 +00:00
qfontdialog Merge remote-tracking branch 'origin/5.7' into dev 2016-05-23 21:09:46 +02:00
qinputdialog QInputDialog: prevent crash in static get*() functions when parent gets deleted 2017-02-06 14:41:46 +00:00
qmessagebox QtWidgets: Remove Windows CE. 2016-04-07 10:24:45 +00:00
qprogressdialog Updated license headers 2016-01-21 18:55:18 +00:00
qsidebar Remove the traces of the discontinued android-no-sdk platform 2016-03-30 10:12:34 +00:00
qwizard tests/auto/widgets: use QCOMPARE(., nullptr) 2016-11-30 07:24:47 +00:00
dialogs.pro Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00