[Libreoffice-commits] core.git: Branch 'feature/useuniqueptr-2' - svtools/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jan 16 15:23:12 UTC 2018


 svtools/source/uno/treecontrolpeer.cxx |    6 ++----
 svtools/source/uno/treecontrolpeer.hxx |    2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit bec4a0deae30fd089d44cc29196ea93f141e680a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 15 16:24:35 2018 +0200

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

diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 6bca0137bc19..36ef421c39ed 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -150,7 +150,6 @@ TreeControlPeer::~TreeControlPeer()
 {
     if( mpTreeImpl )
         mpTreeImpl->Clear();
-    delete mpTreeNodeMap;
 }
 
 
@@ -160,7 +159,7 @@ void TreeControlPeer::addEntry( UnoTreeListEntry* pEntry )
     {
         if( !mpTreeNodeMap )
         {
-            mpTreeNodeMap = new TreeNodeMap;
+            mpTreeNodeMap.reset( new TreeNodeMap );
         }
 
         (*mpTreeNodeMap)[ pEntry->mxNode ] = pEntry;
@@ -207,8 +206,7 @@ vcl::Window* TreeControlPeer::createVclControl( vcl::Window* pParent, sal_Int64
 /** called from the UnoTreeListBoxImpl when it gets deleted */
 void TreeControlPeer::disposeControl()
 {
-    delete mpTreeNodeMap;
-    mpTreeNodeMap = nullptr;
+    mpTreeNodeMap.reset();
     mpTreeImpl = nullptr;
 }
 
diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx
index fc4b7e24348e..e2bcffaf7fec 100644
--- a/svtools/source/uno/treecontrolpeer.hxx
+++ b/svtools/source/uno/treecontrolpeer.hxx
@@ -165,7 +165,7 @@ private:
     OUString msDefaultExpandedGraphicURL;
     Image maDefaultExpandedImage;
     Image maDefaultCollapsedImage;
-    TreeNodeMap* mpTreeNodeMap;
+    std::unique_ptr<TreeNodeMap> mpTreeNodeMap;
     css::uno::Reference< css::graphic::XGraphicProvider > mxGraphicProvider;
 };
 


More information about the Libreoffice-commits mailing list