[Libreoffice-commits] core.git: scripting/source sc/source sw/source

Takeshi Abe tabe at fixedpoint.jp
Tue Aug 26 03:47:52 PDT 2014


 sc/source/ui/miscdlgs/optsolver.cxx                |    5 ++---
 scripting/source/protocolhandler/scripthandler.cxx |    9 +++------
 sw/source/uibase/shells/textidx.cxx                |    3 +--
 3 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 4d32244437475688ca951ce30f8d6fcc59fc1caa
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Tue Aug 26 17:50:33 2014 +0900

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

diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index e42917a..3605065 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -543,14 +543,13 @@ IMPL_LINK( ScOptSolverDlg, BtnHdl, PushButton*, pBtn )
     else if ( pBtn == m_pBtnOpt )
     {
         //! move options dialog to UI lib?
-        ScSolverOptionsDialog* pOptDlg =
-            new ScSolverOptionsDialog( this, maImplNames, maDescriptions, maEngine, maProperties );
+        boost::scoped_ptr<ScSolverOptionsDialog> pOptDlg(
+            new ScSolverOptionsDialog( this, maImplNames, maDescriptions, maEngine, maProperties ));
         if ( pOptDlg->Execute() == RET_OK )
         {
             maEngine = pOptDlg->GetEngine();
             maProperties = pOptDlg->GetProperties();
         }
-        delete pOptDlg;
     }
 
     return 0;
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index b5760b6..e959d3f 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -273,14 +273,11 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
 
         if ( pFact != NULL )
         {
-            VclAbstractDialog* pDlg =
-                pFact->CreateScriptErrorDialog( NULL, aException );
+            boost::scoped_ptr<VclAbstractDialog> pDlg(
+                pFact->CreateScriptErrorDialog( NULL, aException ));
 
-            if ( pDlg != NULL )
-            {
+            if ( pDlg )
                 pDlg->Execute();
-                delete pDlg;
-            }
         }
        }
 
diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx
index 4cbdb61..49c806a 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -84,10 +84,9 @@ void SwTextShell::ExecIdx(SfxRequest &rReq)
             {   // Several marks, which should it be?
                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
                 OSL_ENSURE(pFact, "Dialog creation failed!");
-                VclAbstractDialog* pMultDlg = pFact->CreateMultiTOXMarkDlg(pMDI, aMgr);
+                boost::scoped_ptr<VclAbstractDialog> pMultDlg(pFact->CreateMultiTOXMarkDlg(pMDI, aMgr));
                 OSL_ENSURE(pMultDlg, "Dialog creation failed!");
                 nRet = pMultDlg->Execute();
-                delete pMultDlg;
             }
             if( nRet == RET_OK)
             {


More information about the Libreoffice-commits mailing list