[Libreoffice-commits] core.git: sd/source translations
Takeshi Abe
tabe at fixedpoint.jp
Mon May 26 06:15:46 PDT 2014
sd/source/ui/view/MediaObjectBar.cxx | 9 +++------
sd/source/ui/view/drtxtob1.cxx | 8 ++++----
sd/source/ui/view/drviews3.cxx | 10 ++++++----
sd/source/ui/view/drviews4.cxx | 6 +++---
sd/source/ui/view/drviews5.cxx | 6 +++---
sd/source/ui/view/drviews9.cxx | 6 +++---
sd/source/ui/view/drviewsa.cxx | 8 ++++----
translations | 2 +-
8 files changed, 27 insertions(+), 28 deletions(-)
New commits:
commit ac1f7774b789c747d1aa0135762c2d0d804e69b3
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Mon May 26 22:03:26 2014 +0900
Avoid possible memory leaks in case of exceptions
Change-Id: I185e957da57f4da7dbd2b95496bcd5349fc7d039
diff --git a/sd/source/ui/view/MediaObjectBar.cxx b/sd/source/ui/view/MediaObjectBar.cxx
index c2bfb8a..612faa2 100644
--- a/sd/source/ui/view/MediaObjectBar.cxx
+++ b/sd/source/ui/view/MediaObjectBar.cxx
@@ -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;
}
}
}
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 605983c..c51ab23 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -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 );
}
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 885011d..3b5af17 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -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 ();
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 8289ade..e01ed34 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -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
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 2e98ec5..372a931 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -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;
}
}
}
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index 1d3c798..1524153 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -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;
}
/**
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 8e1e09d..badc272 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -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 ) )
diff --git a/translations b/translations
index b31a574..b1ee9c9 160000
--- a/translations
+++ b/translations
@@ -1 +1 @@
-Subproject commit b31a57455b1bf9dcffd2cee0a4c79c4f6425dd6c
+Subproject commit b1ee9c9e1542b856cfe2412c6dffeeb5a353810a
More information about the Libreoffice-commits
mailing list