Avoid possible memory leaks in case of exceptions
Change-Id: I185e957da57f4da7dbd2b95496bcd5349fc7d039
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include "drawview.hxx"
|
||||
#include "sdresid.hxx"
|
||||
#include "drawdoc.hxx"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
using namespace sd;
|
||||
|
||||
@@ -89,7 +90,7 @@ void MediaObjectBar::GetState( SfxItemSet& rSet )
|
||||
{
|
||||
if( SID_AVMEDIA_TOOLBOX == nWhich )
|
||||
{
|
||||
SdrMarkList* pMarkList = new SdrMarkList( mpView->GetMarkedObjectList() );
|
||||
boost::scoped_ptr<SdrMarkList> pMarkList(new SdrMarkList( mpView->GetMarkedObjectList() ));
|
||||
bool bDisable = true;
|
||||
|
||||
if( 1 == pMarkList->GetMarkCount() )
|
||||
@@ -108,8 +109,6 @@ void MediaObjectBar::GetState( SfxItemSet& rSet )
|
||||
|
||||
if( bDisable )
|
||||
rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
|
||||
|
||||
delete pMarkList;
|
||||
}
|
||||
|
||||
nWhich = aIter.NextWhich();
|
||||
@@ -130,7 +129,7 @@ void MediaObjectBar::Execute( SfxRequest& rReq )
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
SdrMarkList* pMarkList = new SdrMarkList( mpView->GetMarkedObjectList() );
|
||||
boost::scoped_ptr<SdrMarkList> pMarkList(new SdrMarkList( mpView->GetMarkedObjectList() ));
|
||||
|
||||
if( 1 == pMarkList->GetMarkCount() )
|
||||
{
|
||||
@@ -146,8 +145,6 @@ void MediaObjectBar::Execute( SfxRequest& rReq )
|
||||
rDoc.SetChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
delete pMarkList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -150,7 +150,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
|
||||
SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) );
|
||||
aAttr.Put( aTmpSet, false ); // sal_False= InvalidItems is not default, handle it as "holes"
|
||||
const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aAttr.Get( EE_PARA_ULSPACE );
|
||||
SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
|
||||
boost::scoped_ptr<SvxULSpaceItem> pNewItem((SvxULSpaceItem*) rItem.Clone());
|
||||
|
||||
long nUpper = pNewItem->GetUpper();
|
||||
if( nSlot == SID_PARASPACE_INCREASE )
|
||||
@@ -174,7 +174,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
|
||||
|
||||
SfxItemSet aNewAttrs( aAttr );
|
||||
aNewAttrs.Put( *pNewItem );
|
||||
delete pNewItem;
|
||||
pNewItem.reset();
|
||||
pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs );
|
||||
}
|
||||
}
|
||||
@@ -191,7 +191,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
|
||||
{
|
||||
SfxItemSet aNewAttrs(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
|
||||
const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
|
||||
SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
|
||||
boost::scoped_ptr<SvxULSpaceItem> pNewItem((SvxULSpaceItem*) rItem.Clone());
|
||||
long nUpper = pNewItem->GetUpper();
|
||||
|
||||
if( nSlot == SID_PARASPACE_INCREASE )
|
||||
@@ -214,7 +214,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
|
||||
pNewItem->SetLower( (sal_uInt16) nLower );
|
||||
|
||||
aNewAttrs.Put( *pNewItem );
|
||||
delete pNewItem;
|
||||
pNewItem.reset();
|
||||
|
||||
mpView->SetAttributes( aNewAttrs );
|
||||
}
|
||||
|
@@ -83,6 +83,8 @@
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
#include <editeng/lspcitem.hxx>
|
||||
#include <editeng/ulspitem.hxx>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::drawing::framework;
|
||||
using ::com::sun::star::frame::XFrame;
|
||||
@@ -291,11 +293,11 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
|
||||
case SID_INSERT_DATE_TIME:
|
||||
{
|
||||
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
|
||||
AbstractHeaderFooterDialog* pDlg = pFact ? pFact->CreateHeaderFooterDialog( (::ViewShell*)this, GetActiveWindow(), GetDoc(), mpActualPage ) : 0;
|
||||
boost::scoped_ptr<AbstractHeaderFooterDialog> pDlg(pFact ? pFact->CreateHeaderFooterDialog( (::ViewShell*)this, GetActiveWindow(), GetDoc(), mpActualPage ) : 0);
|
||||
if( pDlg )
|
||||
{
|
||||
pDlg->Execute();
|
||||
delete pDlg;
|
||||
pDlg.reset();
|
||||
|
||||
GetActiveWindow()->Invalidate();
|
||||
UpdatePreview( mpActualPage );
|
||||
@@ -315,11 +317,11 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
|
||||
pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage());
|
||||
|
||||
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
|
||||
VclAbstractDialog* pDlg = pFact ? pFact->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage ) : 0;
|
||||
boost::scoped_ptr<VclAbstractDialog> pDlg(pFact ? pFact->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage ) : 0);
|
||||
if( pDlg )
|
||||
{
|
||||
pDlg->Execute();
|
||||
delete pDlg;
|
||||
pDlg.reset();
|
||||
Invalidate();
|
||||
}
|
||||
rReq.Done ();
|
||||
|
@@ -65,6 +65,8 @@
|
||||
#include <svx/svditer.hxx>
|
||||
|
||||
#include <navigatr.hxx>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
namespace sd {
|
||||
|
||||
#define PIPETTE_RANGE 0
|
||||
@@ -558,7 +560,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
|
||||
aMPos = Point( 20, 20 );
|
||||
aFieldPopup.Execute( pWin, aMPos );
|
||||
|
||||
SvxFieldData* pField = aFieldPopup.GetField();
|
||||
boost::scoped_ptr<SvxFieldData> pField(aFieldPopup.GetField());
|
||||
if( pField )
|
||||
{
|
||||
SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
|
||||
@@ -578,8 +580,6 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
|
||||
if( !bSel )
|
||||
aSel.nEndPos--;
|
||||
pOLV->SetSelection( aSel );
|
||||
|
||||
delete pField;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -64,6 +64,7 @@
|
||||
#include "FormShellManager.hxx"
|
||||
#include "LayerDialogContent.hxx"
|
||||
#include "DrawController.hxx"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
namespace sd {
|
||||
|
||||
@@ -619,12 +620,11 @@ void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
|
||||
// Tell the draw view and the tab control of the new active layer.
|
||||
mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
|
||||
pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
|
||||
SdUnoDrawView* pUnoDrawView = new SdUnoDrawView (
|
||||
boost::scoped_ptr<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView (
|
||||
*this,
|
||||
*GetView());
|
||||
*GetView()));
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
|
||||
GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer );
|
||||
delete pUnoDrawView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -59,6 +59,7 @@
|
||||
|
||||
#include <svx/galleryitem.hxx>
|
||||
#include <com/sun/star/gallery/GalleryItemType.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
namespace sd {
|
||||
|
||||
@@ -208,7 +209,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
|
||||
CheckLineTo (rReq);
|
||||
|
||||
SfxBindings& rBindings = GetViewFrame()->GetBindings();
|
||||
SfxItemSet* pAttr = new SfxItemSet ( GetDoc()->GetPool() );
|
||||
boost::scoped_ptr<SfxItemSet> pAttr(new SfxItemSet ( GetDoc()->GetPool() ));
|
||||
|
||||
GetView()->GetAttributes( *pAttr );
|
||||
const SfxItemSet* pArgs = rReq.GetArgs();
|
||||
@@ -733,9 +734,8 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
|
||||
;
|
||||
}
|
||||
|
||||
mpDrawView->SetAttributes (*(const SfxItemSet *) pAttr);
|
||||
mpDrawView->SetAttributes (*(const SfxItemSet *) pAttr.get());
|
||||
rReq.Ignore ();
|
||||
delete pAttr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -69,6 +69,7 @@
|
||||
#include "DrawController.hxx"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
using namespace ::rtl;
|
||||
using namespace ::com::sun::star;
|
||||
@@ -598,13 +599,13 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
|
||||
}
|
||||
else
|
||||
{
|
||||
SvxZoomItem* pZoomItem;
|
||||
boost::scoped_ptr<SvxZoomItem> pZoomItem;
|
||||
sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom();
|
||||
|
||||
if( mbZoomOnPage )
|
||||
pZoomItem = new SvxZoomItem( SVX_ZOOM_WHOLEPAGE, nZoom );
|
||||
pZoomItem.reset(new SvxZoomItem( SVX_ZOOM_WHOLEPAGE, nZoom ));
|
||||
else
|
||||
pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nZoom );
|
||||
pZoomItem.reset(new SvxZoomItem( SVX_ZOOM_PERCENT, nZoom ));
|
||||
|
||||
// constrain area
|
||||
sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
|
||||
@@ -618,7 +619,6 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
|
||||
|
||||
pZoomItem->SetValueSet( nZoomValues );
|
||||
rSet.Put( *pZoomItem );
|
||||
delete pZoomItem;
|
||||
}
|
||||
}
|
||||
if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
|
||||
|
Submodule translations updated: b31a57455b...b1ee9c9e15
Reference in New Issue
Block a user