diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-08-19 22:00:18 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-08-19 23:35:41 +0900 |
commit | 82cb89fa059ea1a0d1e6db05f9edd42d724289f7 (patch) | |
tree | 4246e8f66fac6d63a1359ab2d21eaab522836a61 /chart2 | |
parent | 1ab0e8717bee9fee6c42015647bccfbf1683b8fc (diff) |
Avoid possible memory leaks in case of exceptions
Change-Id: I41392572692bc219ae18ad89d95fc8be47d6812c
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/main/ChartController_Position.cxx | 8 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_TextEdit.cxx | 5 |
2 files changed, 5 insertions, 8 deletions
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index c28c697428bc..91d0f8e052e6 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -40,6 +40,7 @@ #include <svx/dialogs.hrc> #include <vcl/svapp.hxx> #include <osl/mutex.hxx> +#include <boost/scoped_ptr.hpp> namespace chart { @@ -128,7 +129,6 @@ void ChartController::executeDispatch_PositionAndSize() ObjectNameProvider::getName( eObjectType)), m_xUndoManager ); - SfxAbstractTabDialog * pDlg = NULL; try { SfxItemSet aItemSet = m_pDrawViewWrapper->getPositionAndSizeItemSetFromMarkedObject(); @@ -140,8 +140,8 @@ void ChartController::executeDispatch_PositionAndSize() SolarMutexGuard aGuard; SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create(); OSL_ENSURE( pFact, "No dialog factory" ); - pDlg = pFact->CreateSchTransformTabDialog( - m_pChartWindow, &aItemSet, pSdrView, RID_SCH_TransformTabDLG_SVXPAGE_ANGLE, bResizePossible ); + boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSchTransformTabDialog( + m_pChartWindow, &aItemSet, pSdrView, RID_SCH_TransformTabDLG_SVXPAGE_ANGLE, bResizePossible )); OSL_ENSURE( pDlg, "Couldn't create SchTransformTabDialog" ); if( pDlg->Execute() == RET_OK ) @@ -168,11 +168,9 @@ void ChartController::executeDispatch_PositionAndSize() aUndoGuard.commit(); } } - delete pDlg; } catch(const uno::Exception& e) { - delete pDlg; ASSERT_EXCEPTION( e ); } } diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index 5ec36e36abde..43050bf0a9df 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <svl/stritem.hxx> #include <editeng/fontitem.hxx> +#include <boost/scoped_ptr.hpp> namespace chart { @@ -168,7 +169,7 @@ void ChartController::executeDispatch_InsertSpecialCharacter() Font aCurFont = m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont(); aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) ); - SfxAbstractDialog * pDlg = pFact->CreateSfxDialog( m_pChartWindow, aSet, getFrame(), RID_SVXDLG_CHARMAP ); + boost::scoped_ptr<SfxAbstractDialog> pDlg(pFact->CreateSfxDialog( m_pChartWindow, aSet, getFrame(), RID_SVXDLG_CHARMAP )); OSL_ENSURE( pDlg, "Couldn't create SvxCharacterMap dialog" ); if( pDlg->Execute() == RET_OK ) { @@ -206,8 +207,6 @@ void ChartController::executeDispatch_InsertSpecialCharacter() pOutliner->SetUpdateMode(true); pOutlinerView->ShowCursor(); } - - delete pDlg; } uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > |