From 54019e6601421baeda15ea331a07fd60ea1f7125 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 16 Jan 2017 08:50:05 +0200 Subject: new loplugin: useuniqueptr: comphelper Change-Id: Iafbaff60d10c9de7b57421e0c24809b08d813987 Reviewed-on: https://gerrit.libreoffice.org/33146 Tested-by: Jenkins Reviewed-by: Noel Grandin --- comphelper/source/property/MasterPropertySet.cxx | 10 ++++------ comphelper/source/property/propagg.cxx | 3 +-- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index 9fbba145a14b..bd32900ab860 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -27,27 +27,25 @@ #include #include +#include class AutoOGuardArray { - std::unique_ptr< osl::Guard< comphelper::SolarMutex > > * mpGuardArray; + std::vector >> 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 92a37a697258..e68ad495314b 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; } -- cgit