[Libreoffice-commits] core.git: 2 commits - sd/source

Noel Grandin noel.grandin at collabora.co.uk
Mon May 28 06:49:55 UTC 2018


 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx |   18 +++-----------
 sd/source/ui/animations/motionpathtag.cxx                 |   14 +++-------
 sd/source/ui/animations/motionpathtag.hxx                 |    2 -
 sd/source/ui/inc/AccessibleDrawDocumentView.hxx           |    2 -
 4 files changed, 11 insertions(+), 25 deletions(-)

New commits:
commit 326c094ecfb496555b02234a751ab525cea6db55
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon May 21 16:42:53 2018 +0200

    loplugin:useuniqueptr in MotionPathTag
    
    Change-Id: I1f63cf02a99018fbac1bf07b9afe6d7347a973d9
    Reviewed-on: https://gerrit.libreoffice.org/54861
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index 64b22607ef38..ab24218ce38e 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -341,7 +341,7 @@ MotionPathTag::MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, con
 
     mpPathObj->SetMergedItem(XLineTransparenceItem(50));
 
-    mpMark = new SdrMark( mpPathObj, mrView.GetSdrPageView() );
+    mpMark.reset(new SdrMark( mpPathObj, mrView.GetSdrPageView() ));
 
     mpPathObj->AddListener( *this );
 
@@ -778,7 +778,7 @@ bool MotionPathTag::MarkPoint(SdrHdl& rHdl, bool bUnmark )
         SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( &rHdl );
         if( pSmartHdl && pSmartHdl->getTag().get() == this )
         {
-            if (mrView.MarkPointHelper(&rHdl,mpMark,bUnmark))
+            if (mrView.MarkPointHelper(&rHdl,mpMark.get(),bUnmark))
             {
                 mrView.MarkListHasChanged();
                 bRet=true;
@@ -807,7 +807,7 @@ bool MotionPathTag::MarkPoints(const ::tools::Rectangle* pRect, bool bUnmark )
                 Point aPos(pHdl->GetPos());
                 if( pRect==nullptr || pRect->IsInside(aPos))
                 {
-                    if( mrView.MarkPointHelper(pHdl,mpMark,bUnmark) )
+                    if( mrView.MarkPointHelper(pHdl,mpMark.get(),bUnmark) )
                         bChgd=true;
                 }
             }
@@ -854,7 +854,7 @@ void MotionPathTag::CheckPossibilities()
                 bool bSegmFuz(false);
                 basegfx::B2VectorContinuity eSmooth = basegfx::B2VectorContinuity::NONE;
 
-                mrView.CheckPolyPossibilitiesHelper( mpMark, b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
+                mrView.CheckPolyPossibilitiesHelper( mpMark.get(), b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
             }
         }
     }
@@ -987,11 +987,7 @@ void MotionPathTag::disposing()
         SdrObject::Free(pTemp);
     }
 
-    if( mpMark )
-    {
-        delete mpMark;
-        mpMark = nullptr;
-    }
+    mpMark.reset();
 
     SmartTag::disposing();
 }
diff --git a/sd/source/ui/animations/motionpathtag.hxx b/sd/source/ui/animations/motionpathtag.hxx
index 0e785cece1e2..3158f95c2d8b 100644
--- a/sd/source/ui/animations/motionpathtag.hxx
+++ b/sd/source/ui/animations/motionpathtag.hxx
@@ -106,7 +106,7 @@ private:
     css::uno::Reference< css::drawing::XShape > mxOrigin;
     SdrPathObj* mpPathObj;
     css::awt::Point maOriginPos;
-    SdrMark* mpMark;
+    std::unique_ptr<SdrMark> mpMark;
     OUString msLastPath;
     bool mbInUpdatePath;
 };
commit 7f664b591fb9b82569885f8f243e2822fde3a0ae
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon May 21 16:38:13 2018 +0200

    loplugin:useuniqueptr in AccessibleDrawDocumentView
    
    Change-Id: Ibec6b19e83a3c29299382c398ca6a40b92377ede
    Reviewed-on: https://gerrit.libreoffice.org/54860
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index 7899d7e03fa1..355c579d96ce 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -106,7 +106,7 @@ void AccessibleDrawDocumentView::Init()
         xShapeList.set( xView->getCurrentPage(), uno::UNO_QUERY);
 
     // Create the children manager.
-    mpChildrenManager = new ChildrenManager(this, xShapeList, maShapeTreeInfo, *this);
+    mpChildrenManager.reset(new ChildrenManager(this, xShapeList, maShapeTreeInfo, *this));
 
     rtl::Reference<AccessiblePageShape> xPage(CreateDrawPageShape());
     if (xPage.is())
@@ -214,7 +214,7 @@ uno::Reference<XAccessible> SAL_CALL
 
     // Create a copy of the pointer to the children manager and release the
     // mutex before calling any of its methods.
-    ChildrenManager* pChildrenManager = mpChildrenManager;
+    ChildrenManager* pChildrenManager = mpChildrenManager.get();
     aGuard.clear();
 
     // Forward request to children manager.
@@ -730,12 +730,7 @@ void AccessibleDrawDocumentView::Deactivated()
 
 void AccessibleDrawDocumentView::impl_dispose()
 {
-    if (mpChildrenManager != nullptr)
-    {
-        delete mpChildrenManager;
-        mpChildrenManager = nullptr;
-    }
-
+    mpChildrenManager.reset();
     AccessibleDocumentViewBase::impl_dispose();
 }
 
@@ -744,13 +739,8 @@ void AccessibleDrawDocumentView::impl_dispose()
 */
 void SAL_CALL AccessibleDrawDocumentView::disposing()
 {
-
     // Release resources.
-    if (mpChildrenManager != nullptr)
-    {
-        delete mpChildrenManager;
-        mpChildrenManager = nullptr;
-    }
+    mpChildrenManager.reset();
 
     // Forward call to base classes.
     AccessibleDocumentViewBase::disposing ();
diff --git a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
index df03a3eee460..90a64a822967 100644
--- a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
+++ b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
@@ -129,7 +129,7 @@ private:
         responsible to determine the visible shapes and create on demand the
         accessible objects representing them.
     */
-    ChildrenManager* mpChildrenManager;
+    std::unique_ptr<ChildrenManager> mpChildrenManager;
 
     // This method is called from the component helper base class while
     // disposing.


More information about the Libreoffice-commits mailing list