diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-09-06 14:46:49 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-09 14:49:27 +0200 |
commit | c03d0a984682ce5cea5a5882bab0075318b18f08 (patch) | |
tree | ff68e7c62a119d83fa1fd7020f1e3be29fd6f8f1 /src/plugins/platforms/windows/qwindowsdialoghelpers.h | |
parent | 42223a777e28f2e6884cfd5540618ba9b571954e (diff) |
Windows: Use QSharedPointer for the dialog helpers.
The dialog thread can outlive the platform dialog helper if
the helper is destroyed. In that case, IFileDialog::Show()
returns since the parent window is destroyed and then tried
to emit signals on the destroyed helper class instance.
Pass a shared pointer to the native dialog instead of a pointer
to the helper class to the dialog.
Task-number: QTBUG-32494
Task-number: QTBUG-30513
Change-Id: I7c2e769460270a26d886fdefee93ea59c2a17196
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsdialoghelpers.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsdialoghelpers.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h index c0ee60cc1e..1501b02bd9 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h @@ -46,6 +46,7 @@ #include <qpa/qplatformdialoghelper.h> #include <qpa/qplatformtheme.h> #include <QtCore/QStringList> +#include <QtCore/QSharedPointer> QT_BEGIN_NAMESPACE @@ -64,8 +65,9 @@ namespace QWindowsDialogs template <class BaseClass> class QWindowsDialogHelperBase : public BaseClass { + Q_DISABLE_COPY(QWindowsDialogHelperBase) public: - ~QWindowsDialogHelperBase() { deleteNativeDialog(); } + typedef QSharedPointer<QWindowsNativeDialogBase> QWindowsNativeDialogBasePtr; virtual void exec(); virtual bool show(Qt::WindowFlags windowFlags, @@ -79,7 +81,6 @@ protected: QWindowsDialogHelperBase(); QWindowsNativeDialogBase *nativeDialog() const; inline bool hasNativeDialog() const { return m_nativeDialog; } - void deleteNativeDialog(); void timerEvent(QTimerEvent *); private: @@ -88,7 +89,7 @@ private: inline void startDialogThread(); inline void stopTimer(); - QWindowsNativeDialogBase *m_nativeDialog; + QWindowsNativeDialogBasePtr m_nativeDialog; HWND m_ownerWindow; int m_timerId; }; |