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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 06:59:08 UTC 2018


 sw/source/core/doc/docfmt.cxx |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit cf4b4a75ef813b243986b3dc9b5a4be47b218f06
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 13 10:43:45 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 14 08:58:36 2018 +0200

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

diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 6eba1a85d01f..0300c658262f 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1359,13 +1359,13 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader,
         return ;
 
     // The header only contains the reference to the format from the other document!
-    SfxPoolItem* pNewItem = pItem->Clone();
+    std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
 
     SwFrameFormat* pOldFormat;
     if( bCpyHeader )
-         pOldFormat = static_cast<SwFormatHeader*>(pNewItem)->GetHeaderFormat();
+         pOldFormat = static_cast<SwFormatHeader*>(pNewItem.get())->GetHeaderFormat();
     else
-         pOldFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
+         pOldFormat = static_cast<SwFormatFooter*>(pNewItem.get())->GetFooterFormat();
 
     if( pOldFormat )
     {
@@ -1397,12 +1397,11 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader,
                 pNewFormat->ResetFormatAttr( RES_CNTNT );
         }
         if( bCpyHeader )
-            static_cast<SwFormatHeader*>(pNewItem)->RegisterToFormat(*pNewFormat);
+            static_cast<SwFormatHeader*>(pNewItem.get())->RegisterToFormat(*pNewFormat);
         else
-            static_cast<SwFormatFooter*>(pNewItem)->RegisterToFormat(*pNewFormat);
+            static_cast<SwFormatFooter*>(pNewItem.get())->RegisterToFormat(*pNewFormat);
         rDestFormat.SetFormatAttr( *pNewItem );
     }
-    delete pNewItem;
 }
 
 void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,


More information about the Libreoffice-commits mailing list