diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-06-13 03:56:40 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-06-13 03:58:58 +0900 |
commit | 3d3fc58a32211cf56c5238f2d9f0e86a1eb7ae7e (patch) | |
tree | db3201c7886a51db48a78ef189bd69f2a664c5d3 /sw/source/uibase/shells/textidx.cxx | |
parent | b736c78ef454f651154bc4a29dc14e99be3f75f5 (diff) |
Avoid possible memory leaks in case of exceptions
Change-Id: I986805143615f053b918fb1e64b0b24d6f76f2de
Diffstat (limited to 'sw/source/uibase/shells/textidx.cxx')
-rw-r--r-- | sw/source/uibase/shells/textidx.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx index 5bf32722e3c1..b6f55f36dd43 100644 --- a/sw/source/uibase/shells/textidx.cxx +++ b/sw/source/uibase/shells/textidx.cxx @@ -39,6 +39,7 @@ #include "swabstdlg.hxx" #include <index.hrc> #include <globals.hrc> +#include <boost/scoped_ptr.hpp> void SwTextShell::ExecIdx(SfxRequest &rReq) { @@ -57,10 +58,9 @@ void SwTextShell::ExecIdx(SfxRequest &rReq) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); - VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( pMDI, GetShell(), DLG_EDIT_AUTHMARK); + boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateVclAbstractDialog( pMDI, GetShell(), DLG_EDIT_AUTHMARK)); OSL_ENSURE(pDlg, "Dialogdiet fail!"); pDlg->Execute(); - delete pDlg; } break; case FN_INSERT_AUTH_ENTRY_DLG: @@ -93,10 +93,9 @@ void SwTextShell::ExecIdx(SfxRequest &rReq) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); - VclAbstractDialog* pDlg = pFact->CreateIndexMarkModalDlg(pMDI, GetShell(), aMgr.GetCurTOXMark()); + boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateIndexMarkModalDlg(pMDI, GetShell(), aMgr.GetCurTOXMark())); OSL_ENSURE(pDlg, "Dialogdiet fail!"); pDlg->Execute(); - delete pDlg; } break; } @@ -140,12 +139,11 @@ void SwTextShell::ExecIdx(SfxRequest &rReq) } SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); - AbstractMultiTOXTabDialog* pDlg = pFact->CreateMultiTOXTabDialog( + boost::scoped_ptr<AbstractMultiTOXTabDialog> pDlg(pFact->CreateMultiTOXTabDialog( pMDI, aSet, rSh, (SwTOXBase* )pCurTOX, - USHRT_MAX, bGlobal); + USHRT_MAX, bGlobal)); OSL_ENSURE(pDlg, "Dialogdiet fail!"); pDlg->Execute(); - delete pDlg; } break; case FN_REMOVE_CUR_TOX: |