sd/source/ui/inc/OutlinerIteratorImpl.hxx | 2 +- sd/source/ui/unoidl/unolayer.cxx | 6 ++---- sd/source/ui/unoidl/unolayer.hxx | 2 +- sd/source/ui/view/OutlinerIterator.cxx | 15 +++++++-------- 4 files changed, 11 insertions(+), 14 deletions(-)
New commits: commit f2ab7b0ddbd324b3f98e4244bb56254bf030ac3d Author: Noel Grandin <[email protected]> Date: Fri Jun 22 14:13:06 2018 +0200 loplugin:useuniqueptr in ViewIteratorImpl Change-Id: Ia17fbfbbb76d035c669e797c98a095667187ee80 Reviewed-on: https://gerrit.libreoffice.org/56337 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sd/source/ui/inc/OutlinerIteratorImpl.hxx b/sd/source/ui/inc/OutlinerIteratorImpl.hxx index c0f1d757657d..7d71cb17a0c4 100644 --- a/sd/source/ui/inc/OutlinerIteratorImpl.hxx +++ b/sd/source/ui/inc/OutlinerIteratorImpl.hxx @@ -203,7 +203,7 @@ private: /// Pointer to the page associated with the current page index. May be NULL. SdPage* mpPage; /// Iterator of all objects on the current page. - SdrObjListIter* mpObjectIterator; + std::unique_ptr<SdrObjListIter> mpObjectIterator; // Don't use this operator. ViewIteratorImpl& operator= (const ViewIteratorImpl&) = delete; diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index 434f488b463c..ee805e17c8a9 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -553,7 +553,7 @@ IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const if (mpObjectIterator != nullptr) { - pIterator->mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward); + pIterator->mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward) ); // No direct way to set the object iterator to the current object. pIterator->maPosition.mxObject.reset(nullptr); @@ -561,7 +561,7 @@ IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const pIterator->maPosition.mxObject.reset(pIterator->mpObjectIterator->Next()); } else - pIterator->mpObjectIterator = nullptr; + pIterator->mpObjectIterator.reset(); return pIterator; } @@ -598,7 +598,7 @@ void ViewIteratorImpl::GotoNextText() SetPage (maPosition.mnPageIndex-1); if (mpPage != nullptr) - mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward); + mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward) ); if (mpObjectIterator!=nullptr && mpObjectIterator->IsMore()) maPosition.mxObject.reset(mpObjectIterator->Next()); else @@ -650,9 +650,9 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex) // Set up object list iterator. if (mpPage != nullptr) - mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward); + mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward) ); else - mpObjectIterator = nullptr; + mpObjectIterator.reset(); // Get object pointer. if (mpObjectIterator!=nullptr && mpObjectIterator->IsMore()) @@ -675,11 +675,10 @@ void ViewIteratorImpl::Reverse() IteratorImplBase::Reverse (); // Create reversed object list iterator. - delete mpObjectIterator; if (mpPage != nullptr) - mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward); + mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward) ); else - mpObjectIterator = nullptr; + mpObjectIterator.reset(); // Move iterator to the current object. ::tools::WeakReference<SdrObject> xObject = maPosition.mxObject; commit a3c2e5c2ad7ee26044e47277149a15653647eb0e Author: Noel Grandin <[email protected]> Date: Fri Jun 22 14:09:04 2018 +0200 loplugin:useuniqueptr in SdLayerManager Change-Id: I95c17965e7de1daf0b548220326e05371b71b1ae Reviewed-on: https://gerrit.libreoffice.org/56336 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx index b6c6d9a1c968..c7cb0f0387aa 100644 --- a/sd/source/ui/unoidl/unolayer.cxx +++ b/sd/source/ui/unoidl/unolayer.cxx @@ -415,7 +415,7 @@ void SAL_CALL SdLayer::removeEventListener( const uno::Reference< lang::XEventLi SdLayerManager::SdLayerManager( SdXImpressDocument& rMyModel ) throw() :mpModel( &rMyModel) { - mpLayers = new SvUnoWeakContainer; + mpLayers.reset(new SvUnoWeakContainer); } SdLayerManager::~SdLayerManager() throw() @@ -433,9 +433,7 @@ void SAL_CALL SdLayerManager::dispose( ) if( mpLayers ) { mpLayers->dispose(); - - delete mpLayers; - mpLayers = nullptr; + mpLayers.reset(); } } diff --git a/sd/source/ui/unoidl/unolayer.hxx b/sd/source/ui/unoidl/unolayer.hxx index 8217337a5b5d..4388105c6c4e 100644 --- a/sd/source/ui/unoidl/unolayer.hxx +++ b/sd/source/ui/unoidl/unolayer.hxx @@ -165,7 +165,7 @@ public: private: SdXImpressDocument* mpModel; - SvUnoWeakContainer* mpLayers; + std::unique_ptr<SvUnoWeakContainer> mpLayers; ::sd::View* GetView() const throw(); ::sd::DrawDocShell* GetDocShell() const throw() { return mpModel->mpDocShell; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
