Kaydet (Commit) 57320f34 authored tarafından Takeshi Abe's avatar Takeshi Abe

Avoid possible memory leaks in case of exceptions

Change-Id: Ifd98e11380bf00f6126e4c81bcd0cbaf5b22f70d
üst 77bc28be
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -271,14 +272,14 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) ...@@ -271,14 +272,14 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_PHOTOALBUM: case SID_PHOTOALBUM:
{ {
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
VclAbstractDialog* pDlg = pFact ? pFact->CreateSdPhotoAlbumDialog( boost::scoped_ptr<VclAbstractDialog> pDlg(pFact ? pFact->CreateSdPhotoAlbumDialog(
mrSlideSorter.GetContentWindow().get(), mrSlideSorter.GetContentWindow().get(),
pDocument) : 0; pDocument) : 0);
if (pDlg) if (pDlg)
{ {
pDlg->Execute(); pDlg->Execute();
delete pDlg; pDlg.reset();
} }
rRequest.Done (); rRequest.Done ();
} }
...@@ -917,9 +918,9 @@ void SlotManager::RenameSlide (void) ...@@ -917,9 +918,9 @@ void SlotManager::RenameSlide (void)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialogdiet fail!"); DBG_ASSERT(pFact, "Dialogdiet fail!");
AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( boost::scoped_ptr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(
mrSlideSorter.GetContentWindow().get(), mrSlideSorter.GetContentWindow().get(),
aPageName, aDescr); aPageName, aDescr));
DBG_ASSERT(aNameDlg, "Dialogdiet fail!"); DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
aNameDlg->SetText( aTitle ); aNameDlg->SetText( aTitle );
aNameDlg->SetCheckNameHdl( LINK( this, SlotManager, RenameSlideHdl ), true ); aNameDlg->SetCheckNameHdl( LINK( this, SlotManager, RenameSlideHdl ), true );
...@@ -939,7 +940,7 @@ void SlotManager::RenameSlide (void) ...@@ -939,7 +940,7 @@ void SlotManager::RenameSlide (void)
DBG_ASSERT( bResult, "Couldn't rename slide" ); DBG_ASSERT( bResult, "Couldn't rename slide" );
} }
} }
delete aNameDlg; aNameDlg.reset();
// Tell the slide sorter about the name change (necessary for // Tell the slide sorter about the name change (necessary for
// accessibility.) // accessibility.)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment