21#include <osl/diagnose.h>
35 OWeakEventListenerAdapter::OWeakEventListenerAdapter( Reference< XWeak >
const & _rxListener, Reference< XComponent >
const & _rxBroadcaster )
39 OSL_ENSURE( _rxBroadcaster.is(),
"OWeakEventListenerAdapter::OWeakEventListenerAdapter: invalid broadcaster!" );
40 if ( _rxBroadcaster.is() )
42 osl_atomic_increment( &m_refCount );
44 _rxBroadcaster->addEventListener(
this );
46 osl_atomic_decrement( &m_refCount );
47 OSL_ENSURE( m_refCount > 0,
"OWeakEventListenerAdapter::OWeakEventListenerAdapter: oops - not to be used with implementations which hold their listeners weak!" );
54 OSL_ENSURE(
getListener().is(),
"OWeakEventListenerAdapter::OWeakEventListenerAdapter: invalid listener (does not support the XEventListener interface)!" );
58 void OWeakEventListenerAdapter::disposing( std::unique_lock<std::mutex>& )
60 Reference< XComponent > xBroadcaster( getBroadcaster( ), UNO_QUERY );
61 OSL_ENSURE( xBroadcaster.is(),
"OWeakEventListenerAdapter::disposing: broadcaster is invalid in the meantime! How this?" );
62 if ( xBroadcaster.is() )
64 xBroadcaster->removeEventListener(
this );
virtual ~OWeakListenerAdapterBase()
css::uno::Reference< css::uno::XInterface > getListener() const
yet another base for weak listener adapters, this time with some type safety