ucb/source/cacher/contentresultsetwrapper.cxx | 16 ++++++---------- ucb/source/cacher/contentresultsetwrapper.hxx | 7 ++++--- 2 files changed, 10 insertions(+), 13 deletions(-)
New commits: commit f82434b54517cad96416df93e9b5d70c9b0ada45 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jan 22 14:22:38 2018 +0200 loplugin:useuniqueptr in ContentResultSetWrapper Change-Id: I798e5b06a5b2f9377f22a86f7b630ffdc20e10c6 Reviewed-on: https://gerrit.libreoffice.org/48559 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx b/ucb/source/cacher/contentresultsetwrapper.cxx index 3f9f8aea3639..32e6f3edf59b 100644 --- a/ucb/source/cacher/contentresultsetwrapper.cxx +++ b/ucb/source/cacher/contentresultsetwrapper.cxx @@ -132,10 +132,6 @@ void ContentResultSetWrapper::impl_init() ContentResultSetWrapper::~ContentResultSetWrapper() { //call impl_deinit() at start of destructor of derived class - - delete m_pDisposeEventListeners; - delete m_pPropertyChangeListeners; - delete m_pVetoableChangeListeners; }; void ContentResultSetWrapper::impl_deinit() @@ -178,16 +174,16 @@ void ContentResultSetWrapper::impl_getPropertyChangeListenerContainer() { osl::Guard< osl::Mutex > aGuard( m_aMutex ); if ( !m_pPropertyChangeListeners ) - m_pPropertyChangeListeners = - new PropertyChangeListenerContainer_Impl( m_aContainerMutex ); + m_pPropertyChangeListeners.reset( + new PropertyChangeListenerContainer_Impl( m_aContainerMutex ) ); } void ContentResultSetWrapper::impl_getVetoableChangeListenerContainer() { osl::Guard< osl::Mutex > aGuard( m_aMutex ); if ( !m_pVetoableChangeListeners ) - m_pVetoableChangeListeners = - new PropertyChangeListenerContainer_Impl( m_aContainerMutex ); + m_pVetoableChangeListeners.reset( + new PropertyChangeListenerContainer_Impl( m_aContainerMutex ) ); } void ContentResultSetWrapper::impl_notifyPropertyChangeListeners( const PropertyChangeEvent& rEvt ) @@ -437,8 +433,8 @@ void SAL_CALL ContentResultSetWrapper::addEventListener( const Reference< XEvent osl::Guard< osl::Mutex > aGuard( m_aMutex ); if ( !m_pDisposeEventListeners ) - m_pDisposeEventListeners = - new OInterfaceContainerHelper2( m_aContainerMutex ); + m_pDisposeEventListeners.reset( + new OInterfaceContainerHelper2( m_aContainerMutex ) ); m_pDisposeEventListeners->addInterface( Listener ); } diff --git a/ucb/source/cacher/contentresultsetwrapper.hxx b/ucb/source/cacher/contentresultsetwrapper.hxx index 05d412921a98..1dff70d00935 100644 --- a/ucb/source/cacher/contentresultsetwrapper.hxx +++ b/ucb/source/cacher/contentresultsetwrapper.hxx @@ -35,6 +35,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <cppuhelper/interfacecontainer.hxx> #include <comphelper/interfacecontainer2.hxx> +#include <memory> class ContentResultSetWrapperListener; @@ -87,11 +88,11 @@ private: bool m_bDisposed; ///Dispose call ready. bool m_bInDispose;///In dispose call osl::Mutex m_aContainerMutex; - comphelper::OInterfaceContainerHelper2* + std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners; - PropertyChangeListenerContainer_Impl* + std::unique_ptr<PropertyChangeListenerContainer_Impl> m_pPropertyChangeListeners; - PropertyChangeListenerContainer_Impl* + std::unique_ptr<PropertyChangeListenerContainer_Impl> m_pVetoableChangeListeners; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits