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

Noel Grandin noel.grandin at collabora.co.uk
Thu Jul 12 06:32:09 UTC 2018


 sw/inc/undobj.hxx              |    2 +-
 sw/source/core/undo/undobj.cxx |   10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 807d5f11f4e4895a74c999b5f81b42c1a6743060
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jul 11 15:51:20 2018 +0200

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

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 7b6a35479005..70be965c3f14 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -186,7 +186,7 @@ public:
 class SwUndoSaveSection : private SwUndoSaveContent
 {
     std::unique_ptr<SwNodeIndex> m_pMovedStart;
-    SwRedlineSaveDatas* pRedlSaveData;
+    std::unique_ptr<SwRedlineSaveDatas> pRedlSaveData;
     sal_uLong nMvLen;           // Index into UndoNodes-Array.
     sal_uLong nStartPos;
 
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 252557ac08b6..55cffe648bcf 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1195,7 +1195,7 @@ SwUndoSaveSection::~SwUndoSaveSection()
 
         m_pMovedStart.reset();
     }
-    delete pRedlSaveData;
+    pRedlSaveData.reset();
 }
 
 void SwUndoSaveSection::SaveSection( const SwNodeIndex& rSttIdx )
@@ -1219,11 +1219,10 @@ void SwUndoSaveSection::SaveSection(
         SwDoc::CorrAbs( aSttIdx, aEndIdx, SwPosition( aMvStt ), true );
     }
 
-    pRedlSaveData = new SwRedlineSaveDatas;
+    pRedlSaveData.reset( new SwRedlineSaveDatas );
     if( !SwUndo::FillSaveData( aPam, *pRedlSaveData ))
     {
-        delete pRedlSaveData;
-        pRedlSaveData = nullptr;
+        pRedlSaveData.reset();
     }
 
     nStartPos = rRange.aStart.GetIndex();
@@ -1278,8 +1277,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos
         if( pRedlSaveData )
         {
             SwUndo::SetSaveData( *pDoc, *pRedlSaveData );
-            delete pRedlSaveData;
-            pRedlSaveData = nullptr;
+            pRedlSaveData.reset();
         }
     }
 }


More information about the Libreoffice-commits mailing list