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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 11 07:40:53 UTC 2019


 sw/source/core/layout/frmtool.cxx  |   16 ++++++++--------
 sw/source/core/layout/laycache.cxx |    2 +-
 sw/source/core/layout/layhelp.hxx  |    4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 3c7b2b7279bc5d4fd72ae0b1d1fc50812792ed08
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jan 9 15:27:34 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 11 08:40:26 2019 +0100

    use unique_ptr in SwLayHelper
    
    Change-Id: I6b7ee99bb38df882853e3695cd03dcc745c92318
    Reviewed-on: https://gerrit.libreoffice.org/66035
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 429a1066044a..f086f7cc3cf8 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1345,7 +1345,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
     SwPageFrame *pPage = pLay->FindPageFrame();
     const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
     SwFrame       *pFrame = nullptr;
-    SwActualSection *pActualSection = nullptr;
+    std::unique_ptr<SwActualSection> pActualSection;
     SwLayHelper *pPageMaker;
 
     //If the layout will be created (bPages == true) we do head on the progress
@@ -1383,7 +1383,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
         if( ( !pLay->IsInFootnote() || pSct->IsInFootnote() ) &&
             ( !pLay->IsInTab() || pSct->IsInTab() ) )
         {
-            pActualSection = new SwActualSection( nullptr, pSct, nullptr );
+            pActualSection.reset(new SwActualSection( nullptr, pSct, nullptr ));
             OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrame(),
                 "InsertCnt_: Wrong Call" );
         }
@@ -1548,8 +1548,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
             else
             {
                 pFrame = pNode->MakeFrame( pLay );
-                pActualSection = new SwActualSection( pActualSection,
-                                                static_cast<SwSectionFrame*>(pFrame), pNode );
+                pActualSection.reset( new SwActualSection( pActualSection.release(),
+                                                static_cast<SwSectionFrame*>(pFrame), pNode ) );
                 if ( pActualSection->GetUpper() )
                 {
                     //Insert behind the Upper, the "Follow" of the Upper will be
@@ -1638,10 +1638,10 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
 
             //Close the section, where appropriate activate the surrounding
             //section again.
-            SwActualSection *pTmp = pActualSection ? pActualSection->GetUpper() : nullptr;
-            delete pActualSection;
+            SwActualSection *pActualSectionUpper1 = pActualSection ? pActualSection->GetUpper() : nullptr;
+            pActualSection.reset(pActualSectionUpper1);
             pLay = pLay->FindSctFrame();
-            if ( nullptr != (pActualSection = pTmp) )
+            if ( pActualSection )
             {
                 //Could be, that the last SectionFrame remains empty.
                 //Then now is the time to remove them.
@@ -1734,7 +1734,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
             pLay->RemoveFromLayout();
             SwFrame::DestroyFrame(pLay);
         }
-        delete pActualSection;
+        pActualSection.reset();
     }
 
     if ( bPages ) // let the Flys connect to each other
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 014a9fc82ecb..99e0c83bf184 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -515,7 +515,7 @@ bool sanityCheckLayoutCache(SwLayCacheImpl const& rCache,
  * a guess, but a guess with statistical background.
  */
 SwLayHelper::SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* &rpPg,
-                          SwLayoutFrame* &rpL, SwActualSection* &rpA,
+                          SwLayoutFrame* &rpL, std::unique_ptr<SwActualSection> &rpA,
                           sal_uLong nNodeIndex, bool bCache )
     : mrpFrame( rpF )
     , mrpPrv( rpP )
diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx
index 87b832321d98..c05223112afa 100644
--- a/sw/source/core/layout/layhelp.hxx
+++ b/sw/source/core/layout/layhelp.hxx
@@ -103,7 +103,7 @@ class SwLayHelper
     SwFrame* &mrpPrv;
     SwPageFrame* &mrpPage;
     SwLayoutFrame* &mrpLay;
-    SwActualSection* &mrpActualSection;
+    std::unique_ptr<SwActualSection> &mrpActualSection;
     bool mbBreakAfter;
     SwDoc* mpDoc;
     SwLayCacheImpl* mpImpl;
@@ -116,7 +116,7 @@ class SwLayHelper
     void CheckFlyCache_( SwPageFrame* pPage );
 public:
     SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* &rpPg,
-            SwLayoutFrame* &rpL, SwActualSection* &rpA,
+            SwLayoutFrame* &rpL, std::unique_ptr<SwActualSection> &rpA,
             sal_uLong nNodeIndex, bool bCache );
     ~SwLayHelper();
     sal_uLong CalcPageCount();


More information about the Libreoffice-commits mailing list