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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 22 17:05:06 UTC 2018


 sw/source/core/text/txtcache.cxx |    6 +++---
 sw/source/core/text/txtcache.hxx |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 3a58fa09d89bff3d5d8588c9ace3b4af90a9a2ce
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Aug 22 13:41:07 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 22 19:04:39 2018 +0200

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

diff --git a/sw/source/core/text/txtcache.cxx b/sw/source/core/text/txtcache.cxx
index b2f412b07c5b..b0f540a2a024 100644
--- a/sw/source/core/text/txtcache.cxx
+++ b/sw/source/core/text/txtcache.cxx
@@ -21,9 +21,9 @@
 #include <txtfrm.hxx>
 #include "porlay.hxx"
 
-SwTextLine::SwTextLine( SwTextFrame const *pFrame, SwParaPortion *pNew ) :
+SwTextLine::SwTextLine( SwTextFrame const *pFrame, std::unique_ptr<SwParaPortion> pNew ) :
     SwCacheObj( static_cast<void const *>(pFrame) ),
-    pLine( pNew )
+    pLine( std::move(pNew) )
 {
 }
 
@@ -125,7 +125,7 @@ void SwTextFrame::SetPara( SwParaPortion *pNew, bool bDelete )
     }
     else if ( pNew )
     {   // Insert a new one
-        SwTextLine *pTextLine = new SwTextLine( this, pNew );
+        SwTextLine *pTextLine = new SwTextLine( this, std::unique_ptr<SwParaPortion>(pNew) );
         if ( SwTextFrame::GetTextCache()->Insert( pTextLine ) )
             mnCacheIndex = pTextLine->GetCachePos();
         else
diff --git a/sw/source/core/text/txtcache.hxx b/sw/source/core/text/txtcache.hxx
index 805ffa068fef..c42018c8da86 100644
--- a/sw/source/core/text/txtcache.hxx
+++ b/sw/source/core/text/txtcache.hxx
@@ -31,7 +31,7 @@ class SwTextLine : public SwCacheObj
     std::unique_ptr<SwParaPortion> pLine;
 
 public:
-    SwTextLine( SwTextFrame const *pFrame, SwParaPortion *pNew = nullptr );
+    SwTextLine( SwTextFrame const *pFrame, std::unique_ptr<SwParaPortion> pNew = nullptr );
     virtual ~SwTextLine() override;
 
     SwParaPortion *GetPara()       { return pLine.get(); }


More information about the Libreoffice-commits mailing list