Kaydet (Commit) ab8958d8 authored tarafından Noel Grandin's avatar Noel Grandin

use rtl::Reference in DynamicResultSetWrapper

instead of storing both a raw pointer and an uno::Reference

Change-Id: Ia155ebcb856884461871d5992380c364da07a1d3
üst b5881758
......@@ -55,8 +55,7 @@ DynamicResultSetWrapper::DynamicResultSetWrapper(
, m_xMyResultTwo( nullptr )
, m_xListener( nullptr )
{
m_pMyListenerImpl = new DynamicResultSetWrapperListener( this );
m_xMyListenerImpl.set( m_pMyListenerImpl );
m_xMyListenerImpl = new DynamicResultSetWrapperListener( this );
//call impl_init() at the end of constructor of derived class
};
......@@ -86,7 +85,7 @@ void SAL_CALL DynamicResultSetWrapper::impl_deinit()
{
//call this at start of destructor of derived class
m_pMyListenerImpl->impl_OwnerDies();
m_xMyListenerImpl->impl_OwnerDies();
}
void SAL_CALL DynamicResultSetWrapper::impl_EnsureNotDisposed()
......@@ -308,10 +307,10 @@ void SAL_CALL DynamicResultSetWrapper::setSource( const Reference< XInterface >
m_xSource = xSourceDynamic;
xListener = m_xListener;
bStatic = m_bStatic;
xMyListenerImpl = m_xMyListenerImpl;
xMyListenerImpl = m_xMyListenerImpl.get();
}
if( xListener.is() )
xSourceDynamic->setListener( m_xMyListenerImpl );
xSourceDynamic->setListener( m_xMyListenerImpl.get() );
else if( bStatic )
{
Reference< XComponent > xSourceComponent( Source, UNO_QUERY );
......@@ -338,7 +337,7 @@ Reference< XResultSet > SAL_CALL DynamicResultSetWrapper::getStaticResultSet()
xSource = m_xSource;
m_bStatic = true;
xMyListenerImpl.set( m_xMyListenerImpl, UNO_QUERY );
xMyListenerImpl.set( css::uno::Reference< css::ucb::XDynamicResultSetListener >(m_xMyListenerImpl.get()), UNO_QUERY );
}
if( xSource.is() )
......@@ -373,7 +372,7 @@ void SAL_CALL DynamicResultSetWrapper::setListener( const Reference< XDynamicRes
addEventListener( Reference< XEventListener >::query( Listener ) );
xSource = m_xSource;
xMyListenerImpl = m_xMyListenerImpl;
xMyListenerImpl = m_xMyListenerImpl.get();
}
if ( xSource.is() )
xSource->setListener( xMyListenerImpl );
......
......@@ -33,6 +33,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/ucb/XDynamicResultSetListener.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <rtl/ref.hxx>
class DynamicResultSetWrapperListener;
......@@ -49,10 +50,8 @@ private:
comphelper::OInterfaceContainerHelper2*
m_pDisposeEventListeners;
protected:
css::uno::Reference< css::ucb::XDynamicResultSetListener >
rtl::Reference<DynamicResultSetWrapperListener>
m_xMyListenerImpl;
DynamicResultSetWrapperListener*
m_pMyListenerImpl;
css::uno::Reference< css::uno::XComponentContext >
m_xContext;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment