diff options
Diffstat (limited to 'comphelper/source')
-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; |