diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-08-25 10:22:59 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-08-25 10:27:10 +0900 |
commit | 32ce5ae15a8f156b4681c36d248b6731df3457c6 (patch) | |
tree | fba1a1f0e0300b8e4209d593e3cfc7062542a72a /starmath | |
parent | Updated core (diff) | |
download | core-32ce5ae15a8f156b4681c36d248b6731df3457c6.tar.gz core-32ce5ae15a8f156b4681c36d248b6731df3457c6.zip |
Avoid possible memory leaks in case of exceptions
Change-Id: Icc073be041ae0b0c690e869a0edaff3515d1d601
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/view.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 3bfc64c7780b..c934e90ef4f3 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -73,6 +73,7 @@ #include "cursor.hxx" #include "accessibility.hxx" #include "ElementsDockingWindow.hxx" +#include <boost/scoped_ptr.hpp> #define MINZOOM 25 #define MAXZOOM 800 @@ -562,7 +563,7 @@ void SmGraphicWindow::Command(const CommandEvent& rCEvt) { GetParent()->ToTop(); SmResId aResId( RID_VIEWMENU ); - PopupMenu* pPopupMenu = new PopupMenu(aResId); + boost::scoped_ptr<PopupMenu> pPopupMenu(new PopupMenu(aResId)); pPopupMenu->SetSelectHdl(LINK(this, SmGraphicWindow, MenuSelectHdl)); Point aPos(5, 5); if (rCEvt.IsMouseEvent()) @@ -573,7 +574,6 @@ void SmGraphicWindow::Command(const CommandEvent& rCEvt) pViewShell->GetViewFrame()->GetBindings().GetDispatcher() ->ExecutePopup( aResId, this, &aPos ); - delete pPopupMenu; bCallBase = false; } break; @@ -1749,7 +1749,7 @@ void SmViewShell::Execute(SfxRequest& rReq) { if ( !GetViewFrame()->GetFrame().IsInPlace() ) { - AbstractSvxZoomDialog *pDlg = 0; + boost::scoped_ptr<AbstractSvxZoomDialog> pDlg; const SfxItemSet *pSet = rReq.GetArgs(); if ( !pSet ) { @@ -1758,7 +1758,7 @@ void SmViewShell::Execute(SfxRequest& rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet); + pDlg.reset(pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet)); SAL_WARN_IF( !pDlg, "starmath", "Dialog creation failed!" ); pDlg->SetLimits( MINZOOM, MAXZOOM ); if( pDlg->Execute() != RET_CANCEL ) @@ -1797,7 +1797,6 @@ void SmViewShell::Execute(SfxRequest& rReq) break; } } - delete pDlg; } } break; |