diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-13 16:16:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-15 11:27:20 +0200 |
commit | 18e20676024baecaf5719139f80f053f5f1e784a (patch) | |
tree | 54e7d15b178ee373c0c72e153d9b1a427963d889 /svx/source/sdr | |
parent | 82a7c54ad8b9b193e767fcafb5316d3f05e21001 (diff) |
loplugin:useuniqueptr in OverlayObjectList
Change-Id: I641d93e54504c27bcc49bae8edf6286c0a9a471f
Reviewed-on: https://gerrit.libreoffice.org/59024
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/sdr')
-rw-r--r-- | svx/source/sdr/overlay/overlayobjectlist.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx index 706bc692c6e6..8b92e076eda2 100644 --- a/svx/source/sdr/overlay/overlayobjectlist.cxx +++ b/svx/source/sdr/overlay/overlayobjectlist.cxx @@ -41,27 +41,25 @@ namespace sdr void OverlayObjectList::clear() { - for(OverlayObject* pCandidate : maVector) + for(auto & pCandidate : maVector) { if(pCandidate->getOverlayManager()) pCandidate->getOverlayManager()->remove(*pCandidate); - - delete pCandidate; } maVector.clear(); } - void OverlayObjectList::append(OverlayObject* pOverlayObject) + void OverlayObjectList::append(std::unique_ptr<OverlayObject> pOverlayObject) { assert(pOverlayObject && "tried to add invalid OverlayObject to OverlayObjectList"); - maVector.push_back(pOverlayObject); + maVector.push_back(std::move(pOverlayObject)); } bool OverlayObjectList::isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance) const { if(!maVector.empty()) { - OverlayObject* pFirst = maVector.front(); + OverlayObject* pFirst = maVector.front().get(); OverlayManager* pManager = pFirst->getOverlayManager(); if(pManager) @@ -89,7 +87,7 @@ namespace sdr fLogicTolerance, false); - for(OverlayObject* pCandidate : maVector) + for(auto & pCandidate : maVector) { if(pCandidate->isHittable()) { @@ -117,7 +115,7 @@ namespace sdr sal_uInt32 nDiscreteTolerance = DEFAULT_VALUE_FOR_HITTEST_PIXEL; if(!maVector.empty()) { - OverlayObject* pCandidate = maVector.front(); + OverlayObject* pCandidate = maVector.front().get(); OverlayManager* pManager = pCandidate->getOverlayManager(); if(pManager) @@ -137,7 +135,7 @@ namespace sdr { basegfx::B2DRange aRetval; - for(OverlayObject* pCandidate : maVector) + for(auto & pCandidate : maVector) { aRetval.expand(pCandidate->getBaseRange()); } |