[Libreoffice-commits] core.git: comphelper/source include/comphelper

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 16 11:30:14 UTC 2017


 comphelper/source/property/MasterPropertySet.cxx |   10 ++++------
 comphelper/source/property/propagg.cxx           |    3 +--
 include/comphelper/propagg.hxx                   |    3 ++-
 3 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 54019e6601421baeda15ea331a07fd60ea1f7125
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 16 08:50:05 2017 +0200

    new loplugin: useuniqueptr: comphelper
    
    Change-Id: Iafbaff60d10c9de7b57421e0c24809b08d813987
    Reviewed-on: https://gerrit.libreoffice.org/33146
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx
index 9fbba145..bd32900 100644
--- a/comphelper/source/property/MasterPropertySet.cxx
+++ b/comphelper/source/property/MasterPropertySet.cxx
@@ -27,27 +27,25 @@
 #include <osl/diagnose.h>
 
 #include <memory>
+#include <vector>
 
 class AutoOGuardArray
 {
-    std::unique_ptr< osl::Guard< comphelper::SolarMutex > > *  mpGuardArray;
+    std::vector<std::unique_ptr< osl::Guard< comphelper::SolarMutex > >>  maGuardArray;
 
 public:
     explicit AutoOGuardArray( sal_Int32 nNumElements );
     ~AutoOGuardArray();
 
-    std::unique_ptr< osl::Guard< comphelper::SolarMutex > > &  operator[] ( sal_Int32 i ) { return mpGuardArray[i]; }
+    std::unique_ptr< osl::Guard< comphelper::SolarMutex > > &  operator[] ( sal_Int32 i ) { return maGuardArray[i]; }
 };
 
-AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements ) : mpGuardArray(new std::unique_ptr< osl::Guard< comphelper::SolarMutex > >[nNumElements])
+AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements ) : maGuardArray(nNumElements)
 {
 }
 
 AutoOGuardArray::~AutoOGuardArray()
 {
-    //!! release unique_ptr's and thus the mutexes locks
-    delete [] mpGuardArray;
-
 }
 
 
diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx
index 92a37a6..e68ad49 100644
--- a/comphelper/source/property/propagg.cxx
+++ b/comphelper/source/property/propagg.cxx
@@ -334,13 +334,12 @@ OPropertySetAggregationHelper::OPropertySetAggregationHelper( ::cppu::OBroadcast
     :OPropertyStateHelper( rBHlp )
     ,m_bListening( false )
 {
-    m_pForwarder = new PropertyForwarder( *this );
+    m_pForwarder.reset( new PropertyForwarder( *this ) );
 }
 
 
 OPropertySetAggregationHelper::~OPropertySetAggregationHelper()
 {
-    delete m_pForwarder;
 }
 
 
diff --git a/include/comphelper/propagg.hxx b/include/comphelper/propagg.hxx
index 6481dd8..102f2c5 100644
--- a/include/comphelper/propagg.hxx
+++ b/include/comphelper/propagg.hxx
@@ -25,6 +25,7 @@
 #include <comphelper/comphelperdllapi.h>
 
 #include <map>
+#include <memory>
 #include <vector>
 
 
@@ -204,7 +205,7 @@ protected:
     css::uno::Reference< css::beans::XMultiPropertySet>   m_xAggregateMultiSet;
     css::uno::Reference< css::beans::XFastPropertySet>    m_xAggregateFastSet;
 
-    internal::PropertyForwarder*    m_pForwarder;
+    std::unique_ptr<internal::PropertyForwarder>          m_pForwarder;
     bool                            m_bListening : 1;
 
 public:


More information about the Libreoffice-commits mailing list