diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 16:04:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-15 07:26:26 +0100 |
commit | 215254415fc32b754eb948a5c374b14366773afb (patch) | |
tree | 13c1f0eb21ca5b24df238a5e067c9009faee734c /comphelper | |
parent | 7d8e94444d989d0ac4a4055b207726708e9ec0da (diff) |
loplugin:useuniqueptr in comphelper,cppu,registry
Change-Id: Ib353d901827e417498fe4f8e397f1a57c61a9736
Reviewed-on: https://gerrit.libreoffice.org/47794
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/instancelocker.cxx | 8 | ||||
-rw-r--r-- | comphelper/source/misc/instancelocker.hxx | 3 |
2 files changed, 3 insertions, 8 deletions
diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx index 76d2cd1a761a..ec0b27f4180b 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -58,12 +58,6 @@ OInstanceLocker::~OInstanceLocker() catch ( uno::RuntimeException& ) {} } - - if ( m_pListenersContainer ) - { - delete m_pListenersContainer; - m_pListenersContainer = nullptr; - } } // XComponent @@ -96,7 +90,7 @@ void SAL_CALL OInstanceLocker::addEventListener( const uno::Reference< lang::XEv throw lang::DisposedException(); // TODO if ( !m_pListenersContainer ) - m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutex ); + m_pListenersContainer.reset( new ::comphelper::OInterfaceContainerHelper2( m_aMutex ) ); m_pListenersContainer->addInterface( xListener ); } diff --git a/comphelper/source/misc/instancelocker.hxx b/comphelper/source/misc/instancelocker.hxx index cb6d229fc2dd..fb6581317006 100644 --- a/comphelper/source/misc/instancelocker.hxx +++ b/comphelper/source/misc/instancelocker.hxx @@ -33,6 +33,7 @@ #include <cppuhelper/implbase.hxx> #include <comphelper/interfacecontainer2.hxx> #include <rtl/ref.hxx> +#include <memory> class OLockListener; @@ -47,7 +48,7 @@ class OInstanceLocker : public ::cppu::WeakImplHelper< css::lang::XComponent, rtl::Reference< OLockListener > m_xLockListener; - ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners + std::unique_ptr<::comphelper::OInterfaceContainerHelper2> m_pListenersContainer; // list of listeners bool m_bDisposed; bool m_bInitialized; |