diff options
author | Carsten Driesner <cd@openoffice.org> | 2010-03-23 14:51:17 +0100 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2010-03-23 14:51:17 +0100 |
commit | 233f8693159884407027678e229805867274d63f (patch) | |
tree | b92f48e43c456cd9f44fd3e338ac5d711ca41367 /sfx2/source | |
parent | 89af58843bff4f6e17b267542c90ed682ff5363b (diff) |
sw321bf01: #i109363# Fix crash with quickstarter and OOo file dialogs
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 23 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.hxx | 1 |
2 files changed, 22 insertions, 2 deletions
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 1d85552e47ae..3fce25e7e0d6 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -33,6 +33,7 @@ #include <sfx2/app.hxx> #include <vos/mutex.hxx> #include <svtools/imagemgr.hxx> +#include <svtools/miscopt.hxx> // #include <cmdlineargs.hxx> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> @@ -235,6 +236,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : ShutdownIconServiceBase( m_aMutex ), m_bVeto ( false ), m_bListenForTermination ( false ), + m_bSystemDialogs( false ), m_pResMgr( NULL ), m_pFileDlg( NULL ), m_xServiceManager( aSMgr ), @@ -243,6 +245,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : m_pPlugin( 0 ), m_bInitialized( false ) { + m_bSystemDialogs = SvtMiscOptions().UseSystemFileDialog(); } ShutdownIcon::~ShutdownIcon() @@ -376,6 +379,16 @@ void ShutdownIcon::StartFileDialog() { ::vos::OGuard aGuard( Application::GetSolarMutex() ); + bool bDirty = ( m_bSystemDialogs != static_cast<bool>(SvtMiscOptions().UseSystemFileDialog()) ); + + if ( m_pFileDlg && bDirty ) + { + // Destroy instance as changing the system file dialog setting + // forces us to create a new FileDialogHelper instance! + delete m_pFileDlg; + m_pFileDlg = NULL; + } + if ( !m_pFileDlg ) m_pFileDlg = new FileDialogHelper( WB_OPEN | SFXWB_MULTISELECTION, String() ); m_pFileDlg->StartExecuteModal( STATIC_LINK( this, ShutdownIcon, DialogClosedHdl_Impl ) ); @@ -512,8 +525,14 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR #ifdef WNT // #103346 Destroy dialog to prevent problems with custom controls - delete pThis->m_pFileDlg; - pThis->m_pFileDlg = NULL; + // This fix is dependent on the dialog settings. Destroying the dialog here will + // crash the non-native dialog implementation! Therefore make this dependent on + // the settings. + if ( SvtMiscOptions().UseSystemFileDialog() ) + { + delete pThis->m_pFileDlg; + pThis->m_pFileDlg = NULL; + } #endif LeaveModalMode(); diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index 4e7cc6ecc247..d702f2a50977 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -52,6 +52,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase ::osl::Mutex m_aMutex; bool m_bVeto; bool m_bListenForTermination; + bool m_bSystemDialogs; ResMgr* m_pResMgr; sfx2::FileDialogHelper* m_pFileDlg; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; |