summaryrefslogtreecommitdiff
path: root/sw/source/ui/envelp/envfmt.cxx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2014-01-21 10:18:02 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2014-01-21 10:20:41 +0900
commit276cae1e467af0219ea1a45bac331937d7b9dc63 (patch)
tree2dbc72854d7381fd2023946d03d040e460ee621e /sw/source/ui/envelp/envfmt.cxx
parent15974abe63f0d4fc88099634d5cd2ddb9760ec23 (diff)
Use boost::scoped_ptr to avoid resource leaks in case of exception
Change-Id: I05a17a061bfd4c3dbd15fe80c1f1f4f8d8267ea7
Diffstat (limited to 'sw/source/ui/envelp/envfmt.cxx')
-rw-r--r--sw/source/ui/envelp/envfmt.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index e6572340f1a3..d90d95325bc7 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -44,6 +44,8 @@
#include <vector>
#include <algorithm>
+#include <boost/scoped_ptr.hpp>
+
#include "swabstdlg.hxx"
#include "chrdlg.hrc"
@@ -263,7 +265,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
const OUString sFmtStr = pColl->GetName();
- SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_CHAR_ENV, &sFmtStr);
+ boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_CHAR_ENV, &sFmtStr));
OSL_ENSURE(pDlg, "Dialogdiet fail!");
if (pDlg->Execute() == RET_OK)
{
@@ -271,7 +273,6 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
::ConvertAttrGenToChar(aOutputSet, CONV_ATTR_ENV);
pCollSet->Put(aOutputSet);
}
- delete pDlg;
}
else if (sIdent == "paragraph")
{
@@ -302,7 +303,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
::PrepareBoxInfo( aTmpSet, *pSh );
const OUString sFmtStr = pColl->GetName();
- SwParaDlg *pDlg = new SwParaDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr);
+ boost::scoped_ptr<SwParaDlg> pDlg(new SwParaDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr));
if ( pDlg->Execute() == RET_OK )
{
@@ -325,7 +326,6 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
pCollSet->Put(*pOutputSet);
}
}
- delete pDlg;
}
return 0;
}