diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-18 11:42:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-18 14:22:26 +0200 |
commit | b5881758c41eb1eb824bc38e2cbf0da38e850281 (patch) | |
tree | ce3a4c3a0bf1e9753198af5b91c85abbe0c9c117 /ucb | |
parent | 9aedc7f9d9b65136880fe6b13e956f0a1fa19c32 (diff) |
use rtl::Reference in ContentResultSetWrapper
instead of storing both a raw pointer and an uno::Reference
Change-Id: Iba7317e37046c62411bae9d943f9e81f23ff3554
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/cacher/contentresultsetwrapper.cxx | 21 | ||||
-rw-r--r-- | ucb/source/cacher/contentresultsetwrapper.hxx | 5 |
2 files changed, 12 insertions, 14 deletions
diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx b/ucb/source/cacher/contentresultsetwrapper.cxx index c1dd34a98e65..f336f607dd04 100644 --- a/ucb/source/cacher/contentresultsetwrapper.cxx +++ b/ucb/source/cacher/contentresultsetwrapper.cxx @@ -55,8 +55,7 @@ ContentResultSetWrapper::ContentResultSetWrapper( , m_pPropertyChangeListeners( nullptr ) , m_pVetoableChangeListeners( nullptr ) { - m_pMyListenerImpl = new ContentResultSetWrapperListener( this ); - m_xMyListenerImpl.set( m_pMyListenerImpl ); + m_xMyListenerImpl = new ContentResultSetWrapperListener( this ); OSL_ENSURE( m_xResultSetOrigin.is(), "XResultSet is required" ); @@ -127,7 +126,7 @@ void SAL_CALL ContentResultSetWrapper::impl_init() //listen to disposing from Origin: Reference< XComponent > xComponentOrigin( m_xResultSetOrigin, UNO_QUERY ); OSL_ENSURE( xComponentOrigin.is(), "interface XComponent is required" ); - xComponentOrigin->addEventListener( static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) ); + xComponentOrigin->addEventListener( static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) ); } ContentResultSetWrapper::~ContentResultSetWrapper() @@ -143,7 +142,7 @@ void SAL_CALL ContentResultSetWrapper::impl_deinit() { //call this at start of destructor of derived class - m_pMyListenerImpl->impl_OwnerDies(); + m_xMyListenerImpl->impl_OwnerDies(); } //virtual @@ -361,7 +360,7 @@ void SAL_CALL ContentResultSetWrapper::dispose() try { m_xPropertySetOrigin->removePropertyChangeListener( - OUString(), static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) ); + OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) ); } catch( Exception& ) { @@ -370,7 +369,7 @@ void SAL_CALL ContentResultSetWrapper::dispose() try { m_xPropertySetOrigin->removeVetoableChangeListener( - OUString(), static_cast< XVetoableChangeListener * >( m_pMyListenerImpl ) ); + OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) ); } catch( Exception& ) { @@ -379,7 +378,7 @@ void SAL_CALL ContentResultSetWrapper::dispose() Reference< XComponent > xComponentOrigin( m_xResultSetOrigin, UNO_QUERY ); OSL_ENSURE( xComponentOrigin.is(), "interface XComponent is required" ); - xComponentOrigin->removeEventListener( static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) ); + xComponentOrigin->removeEventListener( static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) ); } if (isCleared) @@ -595,7 +594,7 @@ void SAL_CALL ContentResultSetWrapper::addPropertyChangeListener( const OUString try { m_xPropertySetOrigin->addPropertyChangeListener( - OUString(), static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) ); + OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) ); } catch( Exception& ) { @@ -643,7 +642,7 @@ void SAL_CALL ContentResultSetWrapper::addVetoableChangeListener( const OUString try { m_xPropertySetOrigin->addVetoableChangeListener( - OUString(), static_cast< XVetoableChangeListener * >( m_pMyListenerImpl ) ); + OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) ); } catch( Exception& ) { @@ -700,7 +699,7 @@ void SAL_CALL ContentResultSetWrapper::removePropertyChangeListener( const OUStr try { m_xPropertySetOrigin->removePropertyChangeListener( - OUString(), static_cast< XPropertyChangeListener * >( m_pMyListenerImpl ) ); + OUString(), static_cast< XPropertyChangeListener * >( m_xMyListenerImpl.get() ) ); } catch( Exception& ) { @@ -756,7 +755,7 @@ void SAL_CALL ContentResultSetWrapper::removeVetoableChangeListener( const OUStr try { m_xPropertySetOrigin->removeVetoableChangeListener( - OUString(), static_cast< XVetoableChangeListener * >( m_pMyListenerImpl ) ); + OUString(), static_cast< XVetoableChangeListener * >( m_xMyListenerImpl.get() ) ); } catch( Exception& ) { diff --git a/ucb/source/cacher/contentresultsetwrapper.hxx b/ucb/source/cacher/contentresultsetwrapper.hxx index eb063c7eaacf..c9476bb0865e 100644 --- a/ucb/source/cacher/contentresultsetwrapper.hxx +++ b/ucb/source/cacher/contentresultsetwrapper.hxx @@ -21,6 +21,7 @@ #define INCLUDED_UCB_SOURCE_CACHER_CONTENTRESULTSETWRAPPER_HXX #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include <ucbhelper/macros.hxx> #include <osl/mutex.hxx> #include <cppuhelper/weak.hxx> @@ -76,10 +77,8 @@ protected: sal_Int32 m_nForwardOnly; private: - css::uno::Reference< css::beans::XPropertyChangeListener > + rtl::Reference<ContentResultSetWrapperListener> m_xMyListenerImpl; - ContentResultSetWrapperListener* - m_pMyListenerImpl; css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaDataFromOrigin; //XResultSetMetaData from m_xOrigin |