[Libreoffice-commits] core.git: desktop/source editeng/source extensions/source starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Sun Aug 24 18:27:58 PDT 2014
desktop/source/deployment/gui/dp_gui_dialog2.cxx | 5 ++---
editeng/source/editeng/impedit4.cxx | 6 ++----
editeng/source/misc/splwrap.cxx | 9 ++++-----
extensions/source/bibliography/datman.cxx | 7 +++----
starmath/source/view.cxx | 9 ++++-----
5 files changed, 15 insertions(+), 21 deletions(-)
New commits:
commit 32ce5ae15a8f156b4681c36d248b6731df3457c6
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Mon Aug 25 10:22:59 2014 +0900
Avoid possible memory leaks in case of exceptions
Change-Id: Icc073be041ae0b0c690e869a0edaff3515d1d601
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 50c17bc..3856140 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -72,6 +72,7 @@
#include <map>
#include <vector>
+#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
using namespace ::com::sun::star;
@@ -488,11 +489,9 @@ IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleOptionsBtn)
if ( pFact )
{
OUString sExtensionId = GetEntryData( nActive )->m_xPackage->getIdentifier().Value;
- VclAbstractDialog* pDlg = pFact->CreateOptionsDialog( this, sExtensionId, OUString() );
+ boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog( this, sExtensionId, OUString() ));
pDlg->Execute();
-
- delete pDlg;
}
}
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index fd11281..56a1b27 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -191,13 +191,12 @@ EditPaM ImpEditEngine::ReadHTML( SvStream& rInput, const OUString& rBaseURL, Edi
EditPaM ImpEditEngine::ReadBin( SvStream& rInput, EditSelection aSel )
{
// Simply abuse a temporary text object ...
- EditTextObject* pObj = EditTextObject::Create( rInput, NULL );
+ boost::scoped_ptr<EditTextObject> pObj(EditTextObject::Create( rInput, NULL ));
EditPaM aLastPaM = aSel.Max();
if ( pObj )
aLastPaM = InsertText( *pObj, aSel ).Max();
- delete pObj;
return aLastPaM;
}
@@ -2499,7 +2498,7 @@ EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView )
return EE_SPELL_ERRORFOUND;
EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- AbstractThesaurusDialog* pDlg = pFact->CreateThesaurusDialog( pEditView->GetWindow(), xThes, aWord, GetLanguage( aCurSel.Max() ) );
+ boost::scoped_ptr<AbstractThesaurusDialog> pDlg(pFact->CreateThesaurusDialog( pEditView->GetWindow(), xThes, aWord, GetLanguage( aCurSel.Max() ) ));
if ( pDlg->Execute() == RET_OK )
{
// Replace Word...
@@ -2510,7 +2509,6 @@ EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView )
pEditView->ShowCursor( true, false );
}
- delete pDlg;
return EE_SPELL_OK;
}
diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx
index 2a88cc6..bac6ac6 100644
--- a/editeng/source/misc/splwrap.cxx
+++ b/editeng/source/misc/splwrap.cxx
@@ -39,6 +39,7 @@
#include <editeng/editrids.hrc>
#include <editeng/editids.hrc>
#include <editeng/editerr.hxx>
+#include <boost/scoped_ptr.hpp>
#define WAIT_ON() if(pWin != NULL) { pWin->EnterWait(); }
@@ -322,13 +323,12 @@ void SvxSpellWrapper::StartThesaurus( const OUString &rWord, sal_uInt16 nLanguag
WAIT_ON(); // while looking up for initial word
EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- AbstractThesaurusDialog* pDlg = pFact->CreateThesaurusDialog( pWin, xThes, rWord, nLanguage );
+ boost::scoped_ptr<AbstractThesaurusDialog> pDlg(pFact->CreateThesaurusDialog( pWin, xThes, rWord, nLanguage ));
WAIT_OFF();
if ( pDlg->Execute()== RET_OK )
{
ChangeThesWord( pDlg->GetWord() );
}
- delete pDlg;
}
@@ -378,13 +378,12 @@ void SvxSpellWrapper::SpellDocument( )
if (xHyphWord.is())
{
EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- AbstractHyphenWordDialog* pDlg = pFact->CreateHyphenWordDialog( pWin,
+ boost::scoped_ptr<AbstractHyphenWordDialog> pDlg(pFact->CreateHyphenWordDialog( pWin,
xHyphWord->getWord(),
LanguageTag( xHyphWord->getLocale() ).getLanguageType(),
- xHyph, this );
+ xHyph, this ));
pWin = pDlg->GetWindow();
pDlg->Execute();
- delete pDlg;
}
bDialog = false;
pWin = pOld;
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index cc7bb58..f314500 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -68,6 +68,7 @@
#include "bib.hrc"
#include "bibliography.hrc"
#include <connectivity/dbtools.hxx>
+#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
@@ -1433,18 +1434,17 @@ void BibDataManager::RemoveMeAsUidListener()
void BibDataManager::CreateMappingDialog(Window* pParent)
{
- MappingDialog_Impl* pDlg = new MappingDialog_Impl(pParent, this);
+ boost::scoped_ptr<MappingDialog_Impl> pDlg(new MappingDialog_Impl(pParent, this));
if(RET_OK == pDlg->Execute() && pBibView)
{
reload();
}
- delete pDlg;
}
OUString BibDataManager::CreateDBChangeDialog(Window* pParent)
{
OUString uRet;
- DBChangeDialog_Impl * pDlg = new DBChangeDialog_Impl(pParent, this );
+ boost::scoped_ptr<DBChangeDialog_Impl> pDlg(new DBChangeDialog_Impl(pParent, this ));
if(RET_OK == pDlg->Execute())
{
OUString sNewURL = pDlg->GetCurrentURL();
@@ -1453,7 +1453,6 @@ OUString BibDataManager::CreateDBChangeDialog(Window* pParent)
uRet = sNewURL;
}
}
- delete pDlg;
return uRet;
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 3bfc64c..c934e90 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;
More information about the Libreoffice-commits
mailing list