summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2014-08-25 10:22:59 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2014-08-25 10:27:10 +0900
commit32ce5ae15a8f156b4681c36d248b6731df3457c6 (patch)
treefba1a1f0e0300b8e4209d593e3cfc7062542a72a /editeng
parent49feed98a1efa5accb9da4ab280d7cd47dcb344a (diff)
Avoid possible memory leaks in case of exceptions
Change-Id: Icc073be041ae0b0c690e869a0edaff3515d1d601
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit4.cxx6
-rw-r--r--editeng/source/misc/splwrap.cxx9
2 files changed, 6 insertions, 9 deletions
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index fd11281ce858..56a1b27025b5 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 2a88cc669676..bac6ac662f4c 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;