diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-03 17:01:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-07 08:32:51 +0200 |
commit | 8f0167d0e005b2872bba966ab9d72f5cd0f5ad17 (patch) | |
tree | 62d50c647b65b5a7257e4a89fe0291cc3d2cc0d4 /embeddedobj/source | |
parent | d655a8d2455c75921eba7a4431fa3d71048e8129 (diff) |
loplugin:useuniqueptr in OleEmbeddedObject
Change-Id: Ia455b86ec14320234935bce32c0bc33a88db036a
Reviewed-on: https://gerrit.libreoffice.org/53875
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'embeddedobj/source')
-rw-r--r-- | embeddedobj/source/inc/oleembobj.hxx | 3 | ||||
-rw-r--r-- | embeddedobj/source/msole/oleembed.cxx | 3 | ||||
-rw-r--r-- | embeddedobj/source/msole/olemisc.cxx | 9 |
3 files changed, 7 insertions, 8 deletions
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx index e944c6cfd842..59a3782fb7f4 100644 --- a/embeddedobj/source/inc/oleembobj.hxx +++ b/embeddedobj/source/inc/oleembobj.hxx @@ -41,6 +41,7 @@ #include <rtl/ref.hxx> #include <osl/thread.h> +#include <memory> namespace cppu { class OMultiTypeInterfaceContainerHelper; @@ -120,7 +121,7 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper OleComponent* m_pOleComponent; - ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer; + std::unique_ptr<::cppu::OMultiTypeInterfaceContainerHelper> m_pInterfaceContainer; bool m_bReadOnly; diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index e84871d5f304..64d95c3d7a56 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -195,8 +195,7 @@ void OleEmbeddedObject::MoveListeners() } } - delete m_pInterfaceContainer; - m_pInterfaceContainer = nullptr; + m_pInterfaceContainer.reset(); } } diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index 4ae70b745a7a..73c6ffd61a57 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -260,8 +260,7 @@ void OleEmbeddedObject::Dispose() { lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) ); m_pInterfaceContainer->disposeAndClear( aSource ); - delete m_pInterfaceContainer; - m_pInterfaceContainer = nullptr; + m_pInterfaceContainer.reset(); } if ( m_xOwnView.is() ) @@ -409,7 +408,7 @@ void SAL_CALL OleEmbeddedObject::addStateChangeListener( const uno::Reference< e throw lang::DisposedException(); // TODO 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 ); @@ -515,7 +514,7 @@ void SAL_CALL OleEmbeddedObject::addCloseListener( const uno::Reference< util::X throw lang::DisposedException(); // TODO 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 ); } @@ -560,7 +559,7 @@ void SAL_CALL OleEmbeddedObject::addEventListener( const uno::Reference< documen throw lang::DisposedException(); // TODO 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 ); } |