QFileDialog: Protect against nullptr dereference

When the QFileDialog receives a language change event, and native
dialogs are used, this code path dereference a nullptr in the qFileDialogUi member.

Protect by checking the return value of QFileDialogPrivate::usingWidgets() as
done in other places deferencing qFileDialogUi.

Fixes a crash in GammaRay

Change-Id: I3e9eb81c75d9fc983519a58c5ec06e316ac80263
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Kevin Funk 2017-02-15 13:10:04 +01:00
parent 9e888e633b
commit e0c43fb046

View File

@ -656,7 +656,7 @@ void QFileDialogPrivate::retranslateStrings()
/* WIDGETS */
if (options->useDefaultNameFilters())
q->setNameFilter(QFileDialogOptions::defaultNameFilterString());
if (nativeDialogInUse)
if (!usingWidgets())
return;
QList<QAction*> actions = qFileDialogUi->treeView->header()->actions();