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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jul 16 06:38:37 UTC 2018


 sw/inc/undobj.hxx              |    4 ++--
 sw/source/core/undo/untblk.cxx |   11 +++++------
 2 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 43c085f95d7ef985d9b2f229ce346f8fe11d0e34
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 13 11:23:02 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 16 08:38:16 2018 +0200

    loplugin:useuniqueptr in SwUndoInserts
    
    Change-Id: I678798048b5ff5fc917fd2c37180d977a2a1d606
    Reviewed-on: https://gerrit.libreoffice.org/57419
    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 70be965c3f14..2e84ff9c1d6e 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -230,9 +230,9 @@ class SwUndoInsLayFormat;
 class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveContent
 {
     SwTextFormatColl *pTextFormatColl, *pLastNdColl;
-    std::vector<SwFrameFormat*>* pFrameFormats;
+    std::unique_ptr<std::vector<SwFrameFormat*>> pFrameFormats;
     std::vector< std::shared_ptr<SwUndoInsLayFormat> > m_FlyUndos;
-    SwRedlineData* pRedlData;
+    std::unique_ptr<SwRedlineData> pRedlData;
     bool bSttWasTextNd;
 protected:
     sal_uLong nNdDiff;
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index d00210353875..a419e7399280 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -65,7 +65,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
                  nSttNode == pAPos->nNode.GetIndex() )
             {
                 if( !pFrameFormats )
-                    pFrameFormats = new std::vector<SwFrameFormat*>;
+                    pFrameFormats.reset( new std::vector<SwFrameFormat*> );
                 pFrameFormats->push_back( pFormat );
             }
         }
@@ -73,7 +73,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
     // consider Redline
     if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
     {
-        pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() );
+        pRedlData.reset( new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) );
         SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
     }
 }
@@ -141,8 +141,7 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys,
                     pFrameFormats->erase( it );
             }
         }
-        delete pFrameFormats;
-        pFrameFormats = nullptr;
+        pFrameFormats.reset();
     }
 }
 
@@ -156,8 +155,8 @@ SwUndoInserts::~SwUndoInserts()
             rUNds.GetEndOfExtras().GetIndex() - m_pUndoNodeIndex->GetIndex());
         m_pUndoNodeIndex.reset();
     }
-    delete pFrameFormats;
-    delete pRedlData;
+    pFrameFormats.reset();
+    pRedlData.reset();
 }
 
 // Undo Insert operation


More information about the Libreoffice-commits mailing list