Kaydet (Commit) 54019e66 authored tarafından Noel Grandin's avatar Noel Grandin

new loplugin: useuniqueptr: comphelper

Change-Id: Iafbaff60d10c9de7b57421e0c24809b08d813987
Reviewed-on: https://gerrit.libreoffice.org/33146Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 5fb99f27
...@@ -27,27 +27,25 @@ ...@@ -27,27 +27,25 @@
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <memory> #include <memory>
#include <vector>
class AutoOGuardArray class AutoOGuardArray
{ {
std::unique_ptr< osl::Guard< comphelper::SolarMutex > > * mpGuardArray; std::vector<std::unique_ptr< osl::Guard< comphelper::SolarMutex > >> maGuardArray;
public: public:
explicit AutoOGuardArray( sal_Int32 nNumElements ); explicit AutoOGuardArray( sal_Int32 nNumElements );
~AutoOGuardArray(); ~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() AutoOGuardArray::~AutoOGuardArray()
{ {
//!! release unique_ptr's and thus the mutexes locks
delete [] mpGuardArray;
} }
......
...@@ -334,13 +334,12 @@ OPropertySetAggregationHelper::OPropertySetAggregationHelper( ::cppu::OBroadcast ...@@ -334,13 +334,12 @@ OPropertySetAggregationHelper::OPropertySetAggregationHelper( ::cppu::OBroadcast
:OPropertyStateHelper( rBHlp ) :OPropertyStateHelper( rBHlp )
,m_bListening( false ) ,m_bListening( false )
{ {
m_pForwarder = new PropertyForwarder( *this ); m_pForwarder.reset( new PropertyForwarder( *this ) );
} }
OPropertySetAggregationHelper::~OPropertySetAggregationHelper() OPropertySetAggregationHelper::~OPropertySetAggregationHelper()
{ {
delete m_pForwarder;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <comphelper/comphelperdllapi.h> #include <comphelper/comphelperdllapi.h>
#include <map> #include <map>
#include <memory>
#include <vector> #include <vector>
...@@ -204,7 +205,7 @@ protected: ...@@ -204,7 +205,7 @@ protected:
css::uno::Reference< css::beans::XMultiPropertySet> m_xAggregateMultiSet; css::uno::Reference< css::beans::XMultiPropertySet> m_xAggregateMultiSet;
css::uno::Reference< css::beans::XFastPropertySet> m_xAggregateFastSet; css::uno::Reference< css::beans::XFastPropertySet> m_xAggregateFastSet;
internal::PropertyForwarder* m_pForwarder; std::unique_ptr<internal::PropertyForwarder> m_pForwarder;
bool m_bListening : 1; bool m_bListening : 1;
public: public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment