diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 08:25:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 13:06:47 +0200 |
commit | 37192ccc89dda5ca8c274e7cfb8b236fd5aaeb4f (patch) | |
tree | 468c140dfc8f7867e28078c0a30a4cd273325d06 /embeddedobj | |
parent | 9aeccd9ac7b71bfa225e4a2c4dd6692a4659da71 (diff) |
use rtl::Reference in OleEmbeddedObject
instead of raw pointer and manual acquire/release
Change-Id: If626f34f3e0d7689567e2d64f94a84e5c8aae28f
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/inc/oleembobj.hxx | 3 | ||||
-rw-r--r-- | embeddedobj/source/msole/oleembed.cxx | 7 | ||||
-rw-r--r-- | embeddedobj/source/msole/olemisc.cxx | 9 |
3 files changed, 8 insertions, 11 deletions
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx index 4e41552d1a94..f018d01c7ad6 100644 --- a/embeddedobj/source/inc/oleembobj.hxx +++ b/embeddedobj/source/inc/oleembobj.hxx @@ -37,6 +37,7 @@ #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/util/XCloseListener.hpp> #include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> #include <osl/thread.h> @@ -177,7 +178,7 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper OUString m_aLinkURL; // ??? // points to own view provider if the object has no server - OwnView_Impl* m_pOwnView; + rtl::Reference<OwnView_Impl> m_xOwnView; // whether the object should be initialized from clipboard in case of default initialization bool m_bFromClipboard; diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index c15962cd024a..2f8d3fab4f54 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -894,15 +894,14 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID ) } } - if ( !m_pOwnView && m_xObjectStream.is() && m_aFilterName != "Text" ) + if ( !m_xOwnView.is() && m_xObjectStream.is() && m_aFilterName != "Text" ) { try { uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY ); if ( xSeekable.is() ) xSeekable->seek( 0 ); - m_pOwnView = new OwnView_Impl( m_xFactory, m_xObjectStream->getInputStream() ); - m_pOwnView->acquire(); + m_xOwnView = new OwnView_Impl( m_xFactory, m_xObjectStream->getInputStream() ); } catch( uno::RuntimeException& ) { @@ -915,7 +914,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID ) } } - if (!m_pOwnView || !m_pOwnView->Open()) + if (!m_xOwnView.is() || !m_xOwnView->Open()) { //Make a RO copy and see if the OS can find something to at //least display the content for us diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index 843e3b3fbb31..c8288b3edb20 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -67,7 +67,6 @@ OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceF , m_bGotStatus( false ) , m_nStatus( 0 ) , m_nStatusAspect( 0 ) -, m_pOwnView( nullptr ) , m_bFromClipboard( false ) , m_bTriedConversion( false ) { @@ -99,7 +98,6 @@ OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceF , m_bGotStatus( false ) , m_nStatus( 0 ) , m_nStatusAspect( 0 ) -, m_pOwnView( nullptr ) , m_bFromClipboard( false ) , m_bTriedConversion( false ) { @@ -265,11 +263,10 @@ void OleEmbeddedObject::Dispose() m_pInterfaceContainer = nullptr; } - if ( m_pOwnView ) + if ( m_xOwnView.is() ) { - m_pOwnView->Close(); - m_pOwnView->release(); - m_pOwnView = nullptr; + m_xOwnView->Close(); + m_xOwnView.clear(); } if ( m_pOleComponent ) |