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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 26 06:33:40 UTC 2018


 sw/source/uibase/inc/conttree.hxx   |    4 ++--
 sw/source/uibase/utlui/glbltree.cxx |   16 +++++-----------
 2 files changed, 7 insertions(+), 13 deletions(-)

New commits:
commit 78e940247fbf576c7e6e4ae8d62dc3531bba21fe
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 25 12:04:39 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 26 08:33:11 2018 +0200

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

diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index e2e0b62e5435..008968101a35 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -265,10 +265,10 @@ private:
     SwWrtShell*             m_pActiveShell;
     SvTreeListEntry*        m_pEmphasisEntry; // Drag'n Drop emphasis
     SvTreeListEntry*        m_pDDSource;      // source for Drag'n Drop
-    SwGlblDocContents*      m_pSwGlblDocContents; // array with sorted content
+    std::unique_ptr<SwGlblDocContents> m_pSwGlblDocContents; // array with sorted content
 
     SwGlblDocContent*       m_pDocContent;
-    sfx2::DocumentInserter* m_pDocInserter;
+    std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter;
 
     bool                m_bIsInternalDrag     :1;
     bool                m_bLastEntryEmphasis  :1; // Drag'n Drop
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index d1f4025f5b8b..13cc616041fe 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -174,9 +174,7 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, SwNavigationPI* pDialog)
     , m_pActiveShell(nullptr)
     , m_pEmphasisEntry(nullptr)
     , m_pDDSource(nullptr)
-    , m_pSwGlblDocContents(nullptr)
     , m_pDocContent(nullptr)
-    , m_pDocInserter(nullptr)
     , m_bIsInternalDrag(false)
     , m_bLastEntryEmphasis(false)
 {
@@ -204,10 +202,8 @@ SwGlobalTree::~SwGlobalTree()
 
 void SwGlobalTree::dispose()
 {
-    delete m_pSwGlblDocContents;
-    m_pSwGlblDocContents = nullptr;
-    delete m_pDocInserter;
-    m_pDocInserter = nullptr;
+    m_pSwGlblDocContents.reset();
+    m_pDocInserter.reset();
     m_aUpdateTimer.Stop();
     m_xDialog.clear();
     SvTreeListBox::dispose();
@@ -740,8 +736,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const OUString*
     Sequence< OUString > aFileNames;
     if ( !pFileName )
     {
-        delete m_pDocInserter;
-        m_pDocInserter = new ::sfx2::DocumentInserter(GetFrameWeld(), "swriter", sfx2::DocumentInserter::Mode::InsertMulti);
+        m_pDocInserter.reset(new ::sfx2::DocumentInserter(GetFrameWeld(), "swriter", sfx2::DocumentInserter::Mode::InsertMulti));
         m_pDocInserter->StartExecuteModal( LINK( this, SwGlobalTree, DialogClosedHdl ) );
     }
     else if ( !pFileName->isEmpty() )
@@ -1112,12 +1107,11 @@ bool    SwGlobalTree::Update(bool bHard)
         m_pActiveShell = pActView->GetWrtShellPtr();
         if(m_pActiveShell != pOldShell)
         {
-            delete m_pSwGlblDocContents;
-            m_pSwGlblDocContents = nullptr;
+            m_pSwGlblDocContents.reset();
         }
         if(!m_pSwGlblDocContents)
         {
-            m_pSwGlblDocContents = new SwGlblDocContents;
+            m_pSwGlblDocContents.reset(new SwGlblDocContents);
             bRet = true;
             m_pActiveShell->GetGlobalDocContent(*m_pSwGlblDocContents);
         }


More information about the Libreoffice-commits mailing list