diff options
author | Chris Meyer <cmeyer1969@gmail.com> | 2012-10-02 11:07:11 -0700 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@digia.com> | 2012-10-08 08:52:12 +0200 |
commit | ead5449f57cc6cff6f4ca1d2df851ebd06a4cb83 (patch) | |
tree | c04cfcb62eb6d3d375f1c8201894c729d2e8e806 | |
parent | a0311b1dd0b5a46e42ed710b0ce436801d9687ce (diff) | |
download | qtquickcontrols-ead5449f57cc6cff6f4ca1d2df851ebd06a4cb83.tar.gz |
Fix crash when destroying file dialog.
Change-Id: Id03fe0c99c861135dd31a4b2f3244857d9b0cc68
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
-rw-r--r-- | src/qfiledialogitem.cpp | 10 | ||||
-rw-r--r-- | src/qfiledialogitem.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/qfiledialogitem.cpp b/src/qfiledialogitem.cpp index 1c18be04..35385a88 100644 --- a/src/qfiledialogitem.cpp +++ b/src/qfiledialogitem.cpp @@ -82,6 +82,7 @@ QFileDialogItem::QFileDialogItem(): { QObject::connect(_dialog, SIGNAL(accepted()), this, SIGNAL(accepted())); QObject::connect(_dialog, SIGNAL(rejected()), this, SIGNAL(rejected())); + QObject::connect(_dialog, SIGNAL(destroyed()), this, SLOT(dialogDestroyed())); } QFileDialogItem::~QFileDialogItem() @@ -89,6 +90,15 @@ QFileDialogItem::~QFileDialogItem() delete _dialog; } +// If the dialog parent is set in the open() method, we need to watch +// for that parent being destroyed otherwise we'll end up destroying +// the dialog twice (once when the parent view is destructed, and once +// in our own destructor). +void QFileDialogItem::dialogDestroyed() +{ + _dialog = 0; +} + /*! \qmlproperty string FileDialog::title diff --git a/src/qfiledialogitem.h b/src/qfiledialogitem.h index 5d9822ee..ddaa17c4 100644 --- a/src/qfiledialogitem.h +++ b/src/qfiledialogitem.h @@ -103,6 +103,9 @@ Q_SIGNALS: protected: QVariant itemChange(GraphicsItemChange change, const QVariant &value); +private Q_SLOTS: + void dialogDestroyed(); + private: void updateFileMode(); |