From 1b54ea0fb976d0dd322f833cab83afc1a12c5582 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 7 Mar 2013 12:58:41 +0100 Subject: use a scoped_ptr here Change-Id: Iac59e450521b427c5ddb77cb944dd12ef4bb0cea --- sfx2/source/doc/guisaveas.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'sfx2/source/doc') diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 092bf89bd33f..29905f57ef6e 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -922,7 +922,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, aDialogFlags = SFXWB_EXPORT; } - sfx2::FileDialogHelper* pFileDlg = NULL; + boost::scoped_ptr pFileDlg; ::rtl::OUString aDocServiceName = GetDocServiceName(); DBG_ASSERT( !aDocServiceName.isEmpty(), "No document service for this module set!" ); @@ -941,13 +941,13 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), ::rtl::OUString() ); - pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aFilterUIName, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ), rStandardDir, rBlackList ); + pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aFilterUIName, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ), rStandardDir, rBlackList )); pFileDlg->SetCurrentFilter( aFilterUIName ); } else { // This is the normal dialog - pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList ); + pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList )); } if ( aDocServiceName == "com.sun.star.drawing.DrawingDocument" ) @@ -978,7 +978,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, else { // This is the normal dialog - pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList ); + pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList )); pFileDlg->CreateMatcher( aDocServiceName ); } @@ -1066,7 +1066,6 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, String aStringTypeFN; if ( pFileDlg->Execute( pDialogParams, aStringTypeFN ) != ERRCODE_NONE ) { - delete pFileDlg; throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT ); } @@ -1166,8 +1165,6 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, } } - delete pFileDlg; - // merge in results of the dialog execution GetMediaDescr()[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"))] <<= ::rtl::OUString( aURL.GetMainURL( INetURLObject::NO_DECODE )); -- cgit