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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 07:26:52 UTC 2018


 sw/source/core/txtnode/ndtxt.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 52fe7d3196465bd7d4c7e3b4cecda66a7ef0b8ad
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 13 11:26:53 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 14 09:26:21 2018 +0200

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

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 859f33e5f30c..886e3b8ce5e6 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2583,16 +2583,16 @@ SwTextNode* SwTextNode::MakeNewTextNode( const SwNodeIndex& rPos, bool bNext,
                                        bool bChgFollow )
 {
     // ignore hard PageBreak/PageDesc/ColumnBreak from Auto-Set
-    SwAttrSet* pNewAttrSet = nullptr;
+    std::unique_ptr<SwAttrSet> pNewAttrSet;
     // #i75353#
     bool bClearHardSetNumRuleWhenFormatCollChanges( false );
     if( HasSwAttrSet() )
     {
-        pNewAttrSet = new SwAttrSet( *GetpSwAttrSet() );
+        pNewAttrSet.reset(new SwAttrSet( *GetpSwAttrSet() ));
         const SfxItemSet* pTmpSet = GetpSwAttrSet();
 
         if (bNext)     // successor doesn't inherit breaks!
-            pTmpSet = pNewAttrSet;
+            pTmpSet = pNewAttrSet.get();
 
         // !bNext: remove PageBreaks/PageDesc/ColBreak from this
         bool bRemoveFromCache = false;
@@ -2658,9 +2658,9 @@ SwTextNode* SwTextNode::MakeNewTextNode( const SwNodeIndex& rPos, bool bNext,
 
     SwTextFormatColl* pColl = GetTextColl();
 
-    SwTextNode *pNode = new SwTextNode( rPos, pColl, pNewAttrSet );
+    SwTextNode *pNode = new SwTextNode( rPos, pColl, pNewAttrSet.get() );
 
-    delete pNewAttrSet;
+    pNewAttrSet.reset();
 
     const SwNumRule* pRule = GetNumRule();
     if( pRule && pRule == pNode->GetNumRule() && rNds.IsDocNodes() )


More information about the Libreoffice-commits mailing list