Avoid possible memory leaks in case of exceptions
Change-Id: Icc073be041ae0b0c690e869a0edaff3515d1d601
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user