[Libreoffice-commits] core.git: chart2/source

Takeshi Abe tabe at fixedpoint.jp
Tue Aug 19 07:36:33 PDT 2014


 chart2/source/controller/main/ChartController_Position.cxx |    8 +++-----
 chart2/source/controller/main/ChartController_TextEdit.cxx |    5 ++---
 2 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 82cb89fa059ea1a0d1e6db05f9edd42d724289f7
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Tue Aug 19 22:00:18 2014 +0900

    Avoid possible memory leaks in case of exceptions
    
    Change-Id: I41392572692bc219ae18ad89d95fc8be47d6812c

diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
index c28c697..91d0f8e 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 5ec36e3..43050bf 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 >


More information about the Libreoffice-commits mailing list