diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-05-08 10:29:45 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-09 01:36:09 +0200 |
commit | cf48eded4dc0e6c860b48a1d756b5920ffc6a724 (patch) | |
tree | 257d329f30bdea003c09fd3ff842686485d8f2de /src/widgets/dialogs/qdialog.cpp | |
parent | f280efc6201adf8933c9d48a1d5b6983ee9fed9b (diff) |
Don't leak native dialog resources
Have QDialog::~QDialog() call deleteNativeDialog_sys() on the helpers,
so that we don't risk leaking any resources allocated in the helper.
QFileDialog does this now, but not QColorDialog or QFontDialog. The
Cocoa plugin worked around this problem by calling
deleteNativeDialog_sys() itself, but the Windows plugin does not do
this, resulting in leaks.
Change-Id: I380d87c95686c8f3cb260f9242299be27329280d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets/dialogs/qdialog.cpp')
-rw-r--r-- | src/widgets/dialogs/qdialog.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 82a7b1a30d..44463b8d32 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -132,6 +132,14 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const return QPlatformDialogHelper::defaultStyleHint(hint); } +void QDialogPrivate::deleteNativeDialog() +{ + if (QPlatformDialogHelper *helper = platformHelper()) { + helper->deleteNativeDialog_sys(); + nativeDialogInUse = false; + } +} + /*! \class QDialog \brief The QDialog class is the base class of dialog windows. @@ -328,6 +336,7 @@ QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f) QDialog::~QDialog() { + Q_D(QDialog); QT_TRY { // Need to hide() here, as our (to-be) overridden hide() // will not be called in ~QWidget. @@ -335,6 +344,7 @@ QDialog::~QDialog() } QT_CATCH(...) { // we're in the destructor - just swallow the exception } + d->deleteNativeDialog(); } /*! |