summaryrefslogtreecommitdiff
path: root/sw/source/uibase/shells/drwtxtsh.cxx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2014-06-10 17:31:26 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2014-06-10 18:25:54 +0900
commited9d32908dca5740109f0d9f3233721aa3a49775 (patch)
tree601a6f988c2e4824241d0b80bc7f18bbb21b9a74 /sw/source/uibase/shells/drwtxtsh.cxx
parent2da7ce3ba8e5838b782fe4f9e26a29c1c7face54 (diff)
Avoid possible memory leaks in case of exceptions
Change-Id: I0cb10efaa3ab08d2cf1338963917d89bdab15289
Diffstat (limited to 'sw/source/uibase/shells/drwtxtsh.cxx')
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 69bae229721d..f362e30377f1 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -73,6 +73,7 @@
#include <cppuhelper/bootstrap.hxx>
#include "swabstdlg.hxx"
#include "misc.hrc"
+#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -459,9 +460,9 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if ( pFact )
{
- SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog(
+ boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog(
&(GetView().GetViewFrame()->GetWindow()),
- &aNewAttr, pSdrView );
+ &aNewAttr, pSdrView ));
sal_uInt16 nResult = pDlg->Execute();
if (nResult == RET_OK)
@@ -472,8 +473,6 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq)
rReq.Done(*(pDlg->GetOutputItemSet()));
}
}
-
- delete( pDlg );
}
}
break;
@@ -741,8 +740,8 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
// If character is selected, it can be shown
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
- rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ boost::scoped_ptr<SfxAbstractDialog> pDlg(pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ));
sal_uInt16 nResult = pDlg->Execute();
if( nResult == RET_OK )
{
@@ -763,8 +762,6 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
SW_MOD()->ApplyUsrPref(aOpt, &rView);
}
}
-
- delete( pDlg );
}
if( !sSym.isEmpty() )