summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfiledialog.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-28 11:51:35 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-28 11:51:35 +0200
commite918334045612ec2c7c6203845ad05c4a1972e87 (patch)
treeb59bf3a173c6bfa58c3ba9b5bb80df4a093247dc /src/widgets/dialogs/qfiledialog.cpp
parente3cbf0f1962958457f6e09fcfdc92d8cac4b6511 (diff)
parentcf0119bb69592d58ca7e6a75753799ebae61e4b5 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qfiledialog.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: I34bc8a990f8f526889a95a5c7099ef557b9681ad
Diffstat (limited to 'src/widgets/dialogs/qfiledialog.cpp')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 814a203d1c..fc360d8381 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -700,12 +700,14 @@ void QFileDialogPrivate::emitFilesSelected(const QStringList &files)
bool QFileDialogPrivate::canBeNativeDialog() const
{
- Q_Q(const QFileDialog);
+ // Don't use Q_Q here! This function is called from ~QDialog,
+ // so Q_Q calling q_func() invokes undefined behavior (invalid cast in q_func()).
+ const QDialog * const q = static_cast<const QDialog*>(q_ptr);
if (nativeDialogInUse)
return true;
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
|| q->testAttribute(Qt::WA_DontShowOnScreen)
- || (q->options() & QFileDialog::DontUseNativeDialog)) {
+ || (options->options() & QFileDialog::DontUseNativeDialog)) {
return false;
}