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 /editeng/source/misc/splwrap.cxx | |
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 'editeng/source/misc/splwrap.cxx')
-rw-r--r-- | editeng/source/misc/splwrap.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
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; |