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

Noel Grandin noel.grandin at collabora.co.uk
Fri Jun 29 12:43:48 UTC 2018


 sw/source/core/inc/rootfrm.hxx    |    4 ++--
 sw/source/core/layout/newfrm.cxx  |    8 +++-----
 sw/source/core/layout/sectfrm.cxx |    2 +-
 3 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 917d31ad634e3710e63a3c06b8d7ebbb7e4d47ef
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jun 28 14:14:42 2018 +0200

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

diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index c6e4db0561fb..238cb9519af4 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -152,12 +152,12 @@ class SwRootFrame: public SwLayoutFrame
     friend void InitCurrShells( SwRootFrame *pRoot );
     SwViewShell *mpCurrShell;
     SwViewShell *mpWaitingCurrShell;
-    SwCurrShells *mpCurrShells;
+    std::unique_ptr<SwCurrShells> mpCurrShells;
 
     /// One Page per DrawModel per Document; is always the size of the Root
     SdrPage *mpDrawPage;
 
-    SwDestroyList* mpDestroy;
+    std::unique_ptr<SwDestroyList> mpDestroy;
 
     sal_uInt16  mnPhyPageNums; /// Page count
     sal_uInt16 mnAccessibleShells; // Number of accessible shells
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 37bea6e97e65..2df6ffe2739e 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -328,7 +328,7 @@ void SwRootFrame::DeRegisterShell( SwViewShell *pSh )
 
 void InitCurrShells( SwRootFrame *pRoot )
 {
-    pRoot->mpCurrShells = new SwCurrShells;
+    pRoot->mpCurrShells.reset( new SwCurrShells );
 }
 
 /*
@@ -482,15 +482,13 @@ void SwRootFrame::DestroyImpl()
         pDoc->GetDocumentLayoutManager().ClearSwLayouterEntries();
     }
 
-    delete mpDestroy;
-    mpDestroy = nullptr;
+    mpDestroy.reset();
 
     // Remove references
     for ( SwCurrShells::iterator it = mpCurrShells->begin(); it != mpCurrShells->end(); ++it )
         (*it)->pRoot = nullptr;
 
-    delete mpCurrShells;
-    mpCurrShells = nullptr;
+    mpCurrShells.reset();
 
     // Some accessible shells are left => problems on second SwFrame::Destroy call
     assert(0 == mnAccessibleShells);
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index b82cc656d54e..7c4ac9749bf9 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2806,7 +2806,7 @@ void SwSectionFrame::CalcFootnoteContent()
 void SwRootFrame::InsertEmptySct( SwSectionFrame* pDel )
 {
     if( !mpDestroy )
-        mpDestroy = new SwDestroyList;
+        mpDestroy.reset( new SwDestroyList );
     mpDestroy->insert( pDel );
 }
 


More information about the Libreoffice-commits mailing list