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

Noel Grandin noel.grandin at collabora.co.uk
Thu Mar 15 10:58:53 UTC 2018


 sd/inc/undo/undoobjects.hxx         |    6 +++---
 sd/source/core/undo/undoobjects.cxx |   12 +++---------
 2 files changed, 6 insertions(+), 12 deletions(-)

New commits:
commit c7395735777f674bdd40efdfcbf56f488226e633
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 15 10:47:41 2018 +0200

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

diff --git a/sd/inc/undo/undoobjects.hxx b/sd/inc/undo/undoobjects.hxx
index 2e0023246e10..59c120816415 100644
--- a/sd/inc/undo/undoobjects.hxx
+++ b/sd/inc/undo/undoobjects.hxx
@@ -42,9 +42,9 @@ protected:
     virtual void Redo();
 
 private:
-    SfxUndoAction*  mpUndoUsercall;
-    SfxUndoAction*  mpUndoAnimation;
-    SfxUndoAction*  mpUndoPresObj;
+    std::unique_ptr<SfxUndoAction>  mpUndoUsercall;
+    std::unique_ptr<SfxUndoAction>  mpUndoAnimation;
+    std::unique_ptr<SfxUndoAction>  mpUndoPresObj;
 };
 
 class UndoRemoveObject : public SdrUndoRemoveObj, public UndoRemovePresObjectImpl
diff --git a/sd/source/core/undo/undoobjects.cxx b/sd/source/core/undo/undoobjects.cxx
index bd3589c2af98..6b3a4e80876e 100644
--- a/sd/source/core/undo/undoobjects.cxx
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -44,24 +44,21 @@ ViewShellId SdUndoAction::GetViewShellId() const
 }
 
 UndoRemovePresObjectImpl::UndoRemovePresObjectImpl( SdrObject& rObject )
-: mpUndoUsercall(nullptr)
-, mpUndoAnimation(nullptr)
-, mpUndoPresObj(nullptr)
 {
     SdPage* pPage = dynamic_cast< SdPage* >( rObject.GetPage() );
     if( pPage )
     {
         if( pPage->IsPresObj(&rObject) )
-            mpUndoPresObj = new UndoObjectPresentationKind( rObject );
+            mpUndoPresObj.reset( new UndoObjectPresentationKind( rObject ) );
         if( rObject.GetUserCall() )
-            mpUndoUsercall = new UndoObjectUserCall(rObject);
+            mpUndoUsercall.reset( new UndoObjectUserCall(rObject) );
 
         if( pPage->hasAnimationNode() )
         {
             css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY );
             if( pPage->getMainSequence()->hasEffect( xShape ) )
             {
-                mpUndoAnimation = new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage );
+                mpUndoAnimation.reset( new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) );
             }
         }
     }
@@ -69,9 +66,6 @@ UndoRemovePresObjectImpl::UndoRemovePresObjectImpl( SdrObject& rObject )
 
 UndoRemovePresObjectImpl::~UndoRemovePresObjectImpl()
 {
-    delete mpUndoAnimation;
-    delete mpUndoPresObj;
-    delete mpUndoUsercall;
 }
 
 void UndoRemovePresObjectImpl::Undo()


More information about the Libreoffice-commits mailing list