From c03d0a984682ce5cea5a5882bab0075318b18f08 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 6 Sep 2013 14:46:49 +0200 Subject: 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 --- src/plugins/platforms/windows/qwindowsdialoghelpers.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsdialoghelpers.h') 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 #include #include +#include QT_BEGIN_NAMESPACE @@ -64,8 +65,9 @@ namespace QWindowsDialogs template class QWindowsDialogHelperBase : public BaseClass { + Q_DISABLE_COPY(QWindowsDialogHelperBase) public: - ~QWindowsDialogHelperBase() { deleteNativeDialog(); } + typedef QSharedPointer 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; }; -- cgit v1.2.3