summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-31 15:40:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-12 08:43:48 +0200
commite4e4d5713e248f02faf7aa6199b11e152973de8e (patch)
tree836dffa89d0a966e41b1af8270db74b9590def22 /svx
parentd4eabd5da8ea3b5ac40659c22cde19b26b3c002b (diff)
clang-tidy readability-delete-null-pointer
which in turn triggered some loplugin:useuniqueptr Change-Id: I0c38561fc9b68dac44e8cf58c8aa1f582196cc64 Reviewed-on: https://gerrit.libreoffice.org/38281 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx3
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx13
-rw-r--r--svx/source/sdr/properties/textproperties.cxx5
-rw-r--r--svx/source/svdraw/svdedxv.cxx5
-rw-r--r--svx/source/svdraw/svdopath.cxx23
-rw-r--r--svx/source/svdraw/svdpagv.cxx6
-rw-r--r--svx/source/svdraw/textchainflow.cxx6
-rw-r--r--svx/source/xoutdev/xpool.cxx5
8 files changed, 18 insertions, 48 deletions
diff --git a/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx b/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx
index 75ecbf65dc2a..46f6e4d32988 100644
--- a/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx
+++ b/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SVX_INC_SDR_CONTACT_VIEWOBJECTCONTACTOFGRAPHIC_HXX
#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+#include <memory>
class SdrGrafObj;
@@ -40,7 +41,7 @@ namespace sdr
// Member which takes care for the asynch loading events which may be necessary
// for asynch graphics loading.
- sdr::event::AsynchGraphicLoadingEvent* mpAsynchLoadEvent;
+ std::unique_ptr<sdr::event::AsynchGraphicLoadingEvent> mpAsynchLoadEvent;
// async graphics loading helpers. Only to be used internally or from the
// event helper class (in .cxx file)
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index 3b42c3837ebe..16c15b41909b 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -112,7 +112,7 @@ namespace sdr
// Trigger asynchronious SwapIn.
sdr::event::TimerEventHandler& rEventHandler = rObjectContact.GetEventHandler();
- mpAsynchLoadEvent = new sdr::event::AsynchGraphicLoadingEvent(rEventHandler, *this);
+ mpAsynchLoadEvent.reset( new sdr::event::AsynchGraphicLoadingEvent(rEventHandler, *this) );
}
}
else
@@ -142,7 +142,7 @@ namespace sdr
{
// just delete it, this will remove it from the EventHandler and
// will trigger forgetAsynchGraphicLoadingEvent from the destructor
- delete mpAsynchLoadEvent;
+ mpAsynchLoadEvent.reset();
// Invalidate paint areas.
// [1] If a calc document with graphics is loaded then OnLoad will
@@ -222,7 +222,7 @@ namespace sdr
if(mpAsynchLoadEvent)
{
- OSL_ENSURE(!pEvent || mpAsynchLoadEvent == pEvent,
+ OSL_ENSURE(!pEvent || mpAsynchLoadEvent.get() == pEvent,
"ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent: Forced to forget another event then I have scheduled (?)");
// forget event
@@ -302,13 +302,6 @@ namespace sdr
ViewObjectContactOfGraphic::~ViewObjectContactOfGraphic()
{
- // evtl. delete the asynch loading event
- if(mpAsynchLoadEvent)
- {
- // just delete it, this will remove it from the EventHandler and
- // will trigger forgetAsynchGraphicLoadingEvent from the destructor
- delete mpAsynchLoadEvent;
- }
}
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 8cc07bdd9353..b2d840c763fe 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -337,10 +337,7 @@ namespace sdr
}
}
- if(pTempSet)
- {
- delete pTempSet;
- }
+ delete pTempSet;
}
OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, nParaCount);
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index ff71c07db5bb..2657375f311a 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -991,10 +991,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
pGivenOutlinerView = nullptr;
}
}
- if( pTextEditOutliner!=nullptr )
- {
- delete pTextEditOutliner;
- }
+ delete pTextEditOutliner;
pTextEditOutliner=nullptr;
pTextEditOutlinerView=nullptr;
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 0c3dad0cd56f..d4f5ef2e824c 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -52,6 +52,7 @@
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <memory>
using namespace sdr;
@@ -501,12 +502,12 @@ class ImpPathForDragAndCreate
SdrPathObj& mrSdrPathObject;
XPolyPolygon aPathPolygon;
SdrObjKind meObjectKind;
- ImpSdrPathDragData* mpSdrPathDragData;
+ std::unique_ptr<ImpSdrPathDragData>
+ mpSdrPathDragData;
bool mbCreating;
public:
explicit ImpPathForDragAndCreate(SdrPathObj& rSdrPathObject);
- ~ImpPathForDragAndCreate();
// drag stuff
bool beginPathDrag( SdrDragStat& rDrag ) const;
@@ -544,14 +545,6 @@ ImpPathForDragAndCreate::ImpPathForDragAndCreate(SdrPathObj& rSdrPathObject)
{
}
-ImpPathForDragAndCreate::~ImpPathForDragAndCreate()
-{
- if(mpSdrPathDragData)
- {
- delete mpSdrPathDragData;
- }
-}
-
bool ImpPathForDragAndCreate::beginPathDrag( SdrDragStat& rDrag ) const
{
const SdrHdl* pHdl=rDrag.GetHdl();
@@ -585,13 +578,12 @@ bool ImpPathForDragAndCreate::beginPathDrag( SdrDragStat& rDrag ) const
bMultiPointDrag = false;
}
- const_cast<ImpPathForDragAndCreate*>(this)->mpSdrPathDragData = new ImpSdrPathDragData(mrSdrPathObject,*pHdl,bMultiPointDrag,rDrag);
+ const_cast<ImpPathForDragAndCreate*>(this)->mpSdrPathDragData.reset( new ImpSdrPathDragData(mrSdrPathObject,*pHdl,bMultiPointDrag,rDrag) );
if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
{
OSL_FAIL("ImpPathForDragAndCreate::BegDrag(): ImpSdrPathDragData is invalid.");
- delete mpSdrPathDragData;
- const_cast<ImpPathForDragAndCreate*>(this)->mpSdrPathDragData = nullptr;
+ const_cast<ImpPathForDragAndCreate*>(this)->mpSdrPathDragData.reset();
return false;
}
@@ -915,8 +907,7 @@ bool ImpPathForDragAndCreate::endPathDrag(SdrDragStat& rDrag)
}
}
- delete mpSdrPathDragData;
- mpSdrPathDragData = nullptr;
+ mpSdrPathDragData.reset();
return true;
}
@@ -992,7 +983,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag
else
{
// #i103058# standard for modification; model and handle needed
- ImpSdrPathDragData* pDragData = mpSdrPathDragData;
+ ImpSdrPathDragData* pDragData = mpSdrPathDragData.get();
if(!pDragData)
{
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index a4d4c34d949a..c099553241e4 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -182,11 +182,7 @@ void SdrPageView::RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow)
if(pCandidate)
{
pCandidate = RemovePageWindow(*pCandidate);
-
- if(pCandidate)
- {
- delete pCandidate;
- }
+ delete pCandidate;
}
}
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 3f0f07dea1b8..559e6b9bd210 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -46,10 +46,8 @@ TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget)
TextChainFlow::~TextChainFlow()
{
- if (mpOverflChText)
- delete mpOverflChText;
- if (mpUnderflChText)
- delete mpUnderflChText;
+ delete mpOverflChText;
+ delete mpUnderflChText;
}
void TextChainFlow::impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *)
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
index ff064151105b..317ca98bc834 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -179,10 +179,7 @@ XOutdevItemPool::~XOutdevItemPool()
// release and delete static pool default items
ReleaseDefaults(true);
- if(mpLocalItemInfos)
- {
- delete[] mpLocalItemInfos;
- }
+ delete[] mpLocalItemInfos;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */