From 018e2f629e125f1a0fe33471a0e4fe606813aa91 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Mon, 19 May 2014 22:25:31 +0900 Subject: Avoid possible memory leaks in case of exceptions Change-Id: I61fe5f5fff157531de9962a2dd4e6e0431e8601c --- sd/source/ui/animations/CustomAnimationPane.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'sd/source/ui/animations') diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 457e2de93c5c..8ccd1176f812 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -82,6 +82,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::animations; @@ -1562,15 +1563,13 @@ void CustomAnimationPane::showOptions(const OString& sPage) { STLPropertySet* pSet = createSelectionSet(); - CustomAnimationDialog* pDlg = new CustomAnimationDialog(this, pSet, sPage); + boost::scoped_ptr pDlg(new CustomAnimationDialog(this, pSet, sPage)); if( pDlg->Execute() ) { addUndo(); changeSelection( pDlg->getResultSet(), pSet ); updateControls(); } - - delete pDlg; } void CustomAnimationPane::onChangeCurrentPage() @@ -1743,7 +1742,7 @@ void CustomAnimationPane::onChange( bool bCreate ) } } - CustomAnimationCreateDialog* pDlg = new CustomAnimationCreateDialog( this, this, aTargets, bHasText, sPresetId, fDuration ); + boost::scoped_ptr pDlg(new CustomAnimationCreateDialog( this, this, aTargets, bHasText, sPresetId, fDuration )); if( pDlg->Execute() ) { addUndo(); @@ -1812,7 +1811,7 @@ void CustomAnimationPane::onChange( bool bCreate ) mrBase.GetDocShell()->SetModified(); } - delete pDlg; + pDlg.reset(); updateControls(); -- cgit