diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-28 10:13:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-05 07:27:00 +0100 |
commit | 1fa230f73c907b1003034e17134275595f19f0e6 (patch) | |
tree | 3387af53d9bcaf02bb1a031e0becfaf0a3162a2b | |
parent | 3b8cd4f95d214e79ffc7e69af094ed0df1cc4788 (diff) |
loplugin:useuniqueptr in chelp::ResultSetBase
Change-Id: I6e8541837a07c8cf2e001289e0804d7e4e7ba3b1
Reviewed-on: https://gerrit.libreoffice.org/50658
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/resultsetbase.cxx | 15 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/resultsetbase.hxx | 7 |
2 files changed, 10 insertions, 12 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx index 70fdf9c5e0e5..8d5fb3f3722a 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx @@ -48,9 +48,6 @@ ResultSetBase::ResultSetBase( const uno::Reference< uno::XComponentContext >& r ResultSetBase::~ResultSetBase() { - delete m_pIsFinalListeners; - delete m_pRowCountListeners; - delete m_pDisposeEventListeners; } @@ -96,8 +93,8 @@ ResultSetBase::addEventListener( osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pDisposeEventListeners ) - m_pDisposeEventListeners = - new comphelper::OInterfaceContainerHelper2( m_aMutex ); + m_pDisposeEventListeners.reset( + new comphelper::OInterfaceContainerHelper2( m_aMutex )); m_pDisposeEventListeners->addInterface( Listener ); } @@ -453,8 +450,8 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener( { osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pIsFinalListeners ) - m_pIsFinalListeners = - new comphelper::OInterfaceContainerHelper2( m_aMutex ); + m_pIsFinalListeners.reset( + new comphelper::OInterfaceContainerHelper2( m_aMutex )); m_pIsFinalListeners->addInterface( xListener ); } @@ -462,8 +459,8 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener( { osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pRowCountListeners ) - m_pRowCountListeners = - new comphelper::OInterfaceContainerHelper2( m_aMutex ); + m_pRowCountListeners.reset( + new comphelper::OInterfaceContainerHelper2( m_aMutex )); m_pRowCountListeners->addInterface( xListener ); } else diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx index af6d4a6959ce..9c1a016030dd 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx @@ -20,6 +20,7 @@ #define INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_RESULTSETBASE_HXX #include <vector> +#include <memory> #include <cppuhelper/weak.hxx> #include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/XComponent.hpp> @@ -390,10 +391,10 @@ namespace chelp { css::uno::Sequence< css::beans::Property > m_sProperty; osl::Mutex m_aMutex; - comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners; - comphelper::OInterfaceContainerHelper2* m_pRowCountListeners; - comphelper::OInterfaceContainerHelper2* m_pIsFinalListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pRowCountListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pIsFinalListeners; }; |