23#include <osl/diagnose.h>
28#include <com/sun/star/lang/DisposedException.hpp>
64 void SAL_CALL
acquire() noexcept override;
65 void SAL_CALL
release() noexcept override;
92 rType,
static_cast< XAdapter *
>(
this ),
static_cast< XInterface *
>(
this ) );
119 std::vector<Reference<XReference>> aCopy;
136 catch (css::lang::DisposedException &) {}
213 static_cast< XWeak *
>(
this ),
static_cast< XInterface *
>(
this ) );
225 if (osl_atomic_decrement( &
m_refCount ) == 0) {
236 OSL_PRECOND(
m_refCount == 0,
"OWeakObject::disposeWeakConnectionPoint: only to be called with a ref count of 0!" );
237 if (m_pWeakConnectionPoint !=
nullptr) {
239 m_pWeakConnectionPoint =
nullptr;
257 if (!m_pWeakConnectionPoint)
261 if( !m_pWeakConnectionPoint )
265 m_pWeakConnectionPoint =
p;
269 return m_pWeakConnectionPoint;
312 static_cast< XAggregation *
>(
this ),
313 static_cast< XWeak *
>(
this ) );
343 void SAL_CALL
acquire() noexcept override;
344 void SAL_CALL
release() noexcept override;
347 void SAL_CALL
dispose() override;
405 rType,
static_cast< XReference *
>(
this ),
static_cast< XInterface *
>(
this ) );
434 xAdp->removeReference(
static_cast<XReference*
>(
this));
487 if (
this == &rWeakRef)
499 std::swap(m_pImpl, other.m_pImpl);
545 xAdp =
m_pImpl->m_XWeakConnectionPoint;
549 return xAdp->queryAdapted();
OWeakRefListener(const Reference< XInterface > &xInt)
void SAL_CALL release() noexcept override
Any SAL_CALL queryInterface(const Type &rType) override
oslInterlockedCount m_aRefCount
The reference counter.
OWeakRefListener(const OWeakRefListener &)=delete
Reference< XAdapter > m_XWeakConnectionPoint
The connection point of the weak object, guarded by getWeakMutex()
const OWeakRefListener & operator=(const OWeakRefListener &)=delete
void SAL_CALL dispose() override
virtual ~OWeakRefListener()
void SAL_CALL acquire() noexcept override
The WeakReferenceHelper holds a weak reference to an object.
~WeakReferenceHelper()
Releases this reference.
WeakReferenceHelper &SAL_CALL operator=(const WeakReferenceHelper &rWeakRef)
Releases this reference and takes over rWeakRef.
WeakReferenceHelper()
Default ctor.
void SAL_CALL clear()
Releases this reference.
css::uno::Reference< css::uno::XInterface > SAL_CALL get() const
Gets a hard reference to the object.
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &rType) SAL_OVERRIDE
Called by the delegator or queryInterface.
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) SAL_OVERRIDE
If a delegator is set, then the delegator is queried for the demanded interface.
css::uno::WeakReferenceHelper xDelegator
weak reference to delegator.
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
virtual void SAL_CALL setDelegator(const css::uno::Reference< css::uno::XInterface > &Delegator) SAL_OVERRIDE
Set the delegator.
virtual ~OWeakAggObject() SAL_OVERRIDE
Virtual dtor.
virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
oslInterlockedCount m_aRefCount
The reference counter.
void SAL_CALL removeReference(const css::uno::Reference< css::uno::XReference > &xRef) override
OWeakConnectionPoint(const OWeakConnectionPoint &)=delete
OWeakObject * m_pObject
The weak object.
void SAL_CALL acquire() noexcept override
void SAL_CALL addReference(const css::uno::Reference< css::uno::XReference > &xRef) override
OWeakConnectionPoint(OWeakObject *pObj)
Hold the weak object without an acquire (only the pointer).
Any SAL_CALL queryInterface(const Type &rType) override
const OWeakConnectionPoint & operator=(const OWeakConnectionPoint &)=delete
std::vector< Reference< XReference > > m_aReferences
The container to hold the weak references.
css::uno::Reference< css::uno::XInterface > SAL_CALL queryAdapted() override
void SAL_CALL release() noexcept override
void dispose()
Called from the weak object if the reference count goes to zero.
Base class to implement a UNO object supporting weak references, i.e.
virtual ~OWeakObject() COVERITY_NOEXCEPT_FALSE
Virtual dtor.
oslInterlockedCount m_refCount
reference count.
void disposeWeakConnectionPoint()
disposes and resets m_pWeakConnectionPoint
virtual css::uno::Reference< css::uno::XAdapter > SAL_CALL queryAdapter() SAL_OVERRIDE
XWeak::queryAdapter() implementation.
friend class OWeakConnectionPoint
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
increasing m_refCount
virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
decreasing m_refCount
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) SAL_OVERRIDE
Basic queryInterface() implementation supporting com::sun::star::uno::XWeak and com::sun::star::uno::...
#define SAL_WARN(area, stream)
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
void SAL_CALL throwException(Any const &exc)
Any SAL_CALL getCaughtException()
Use this function to get the dynamic type of a caught C++-UNO exception; completes the above function...
static std::mutex * gpWeakMutex