diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-01-12 16:53:38 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-01-13 08:04:49 +0100 |
commit | 13ca560d136e833efabef843c57771c96d865964 (patch) | |
tree | b6002d5e5e382c0a62bb67d4f2c30111d1df4268 /embeddedobj | |
parent | 55a754cca0f299b658d99684caa9e15cbdd90cc6 (diff) |
Fix memory leak
Change-Id: I82ce013a42ac1cd9bb4f3842e9fba8fbc6056b3c
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/general/dummyobject.cxx | 8 | ||||
-rw-r--r-- | embeddedobj/source/inc/dummyobject.hxx | 11 |
2 files changed, 11 insertions, 8 deletions
diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx index caaf3881a450..9af31b67c495 100644 --- a/embeddedobj/source/general/dummyobject.cxx +++ b/embeddedobj/source/general/dummyobject.cxx @@ -30,8 +30,6 @@ #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#include <cppuhelper/interfacecontainer.h> - #include <dummyobject.hxx> @@ -594,7 +592,7 @@ void SAL_CALL ODummyEmbeddedObject::addStateChangeListener( const uno::Reference return; if ( !m_pInterfaceContainer ) - m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); + m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<embed::XStateChangeListener>::get(), xListener ); @@ -676,7 +674,7 @@ void SAL_CALL ODummyEmbeddedObject::addCloseListener( const uno::Reference< util return; if ( !m_pInterfaceContainer ) - m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); + m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<util::XCloseListener>::get(), xListener ); } @@ -700,7 +698,7 @@ void SAL_CALL ODummyEmbeddedObject::addEventListener( const uno::Reference< docu return; if ( !m_pInterfaceContainer ) - m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); + m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex )); m_pInterfaceContainer->addInterface( cppu::UnoType<document::XEventListener>::get(), xListener ); } diff --git a/embeddedobj/source/inc/dummyobject.hxx b/embeddedobj/source/inc/dummyobject.hxx index 1a0739c43dee..2587bcc6f89f 100644 --- a/embeddedobj/source/inc/dummyobject.hxx +++ b/embeddedobj/source/inc/dummyobject.hxx @@ -20,12 +20,17 @@ #ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX #define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX +#include <sal/config.h> + +#include <memory> + #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/XEmbedPersist.hpp> #include <cppuhelper/implbase.hxx> +#include <cppuhelper/interfacecontainer.hxx> namespace com { namespace sun { namespace star { namespace embed { @@ -49,7 +54,8 @@ class ODummyEmbeddedObject : public ::cppu::WeakImplHelper , css::embed::XEmbedPersist > { ::osl::Mutex m_aMutex; - ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer; + std::unique_ptr<cppu::OMultiTypeInterfaceContainerHelper> + m_pInterfaceContainer; bool m_bDisposed; OUString m_aEntryName; @@ -75,8 +81,7 @@ protected: public: ODummyEmbeddedObject() - : m_pInterfaceContainer( nullptr ) - , m_bDisposed( false ) + : m_bDisposed( false ) , m_nObjectState( -1 ) , m_nCachedAspect( 0 ) , m_bHasCachedSize( false ) |