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

Noel Grandin noel.grandin at collabora.co.uk
Tue Jul 3 06:18:08 UTC 2018


 sw/source/core/text/pordrop.hxx |    8 ++++----
 sw/source/core/text/txtdrop.cxx |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 24218c21712bc900a6641bd1844878f07b173df7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jul 2 14:45:07 2018 +0200

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

diff --git a/sw/source/core/text/pordrop.hxx b/sw/source/core/text/pordrop.hxx
index e0f7a4ea21f4..7d2293d17648 100644
--- a/sw/source/core/text/pordrop.hxx
+++ b/sw/source/core/text/pordrop.hxx
@@ -33,8 +33,8 @@ extern SwDropCapCache *pDropCapCache;
 // attribute changes inside them.
 class SwDropPortionPart
 {
-    SwDropPortionPart* pFollow;
-    SwFont* pFnt;
+    std::unique_ptr<SwDropPortionPart> pFollow;
+    std::unique_ptr<SwFont> pFnt;
     TextFrameIndex nLen;
     sal_uInt16 nWidth;
     bool m_bJoinBorderWithNext;
@@ -45,8 +45,8 @@ public:
             : pFollow( nullptr ), pFnt( &rFont ), nLen( nL ), nWidth( 0 ), m_bJoinBorderWithNext(false), m_bJoinBorderWithPrev(false) {};
     ~SwDropPortionPart();
 
-    SwDropPortionPart* GetFollow() const { return pFollow; };
-    void SetFollow( SwDropPortionPart* pNew ) { pFollow = pNew; };
+    SwDropPortionPart* GetFollow() const { return pFollow.get(); };
+    void SetFollow( std::unique_ptr<SwDropPortionPart> pNew ) { pFollow = std::move(pNew); };
     SwFont& GetFont() const { return *pFnt; }
     TextFrameIndex GetLen() const { return nLen; }
     sal_uInt16 GetWidth() const { return nWidth; }
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 317eb084a4c1..6ced927d91cb 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -95,8 +95,8 @@ SwDropSave::~SwDropSave()
 /// SwDropPortionPart DTor
 SwDropPortionPart::~SwDropPortionPart()
 {
-    delete pFollow;
-    delete pFnt;
+    pFollow.reset();
+    pFnt.reset();
 }
 
 /// SwDropPortion CTor, DTor
@@ -641,7 +641,7 @@ SwDropPortion *SwTextFormatter::NewDropPortion( SwTextFormatInfo &rInf )
         if ( ! pCurrPart )
             pDropPor->SetPart( pPart );
         else
-            pCurrPart->SetFollow( pPart );
+            pCurrPart->SetFollow( std::unique_ptr<SwDropPortionPart>(pPart) );
 
         pCurrPart = pPart;
     }


More information about the Libreoffice-commits mailing list