diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index 6bb353faa9bd..446cdc0e43ba 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -232,7 +233,7 @@ void SAL_CALL OWeakObject::release() noexcept void OWeakObject::disposeWeakConnectionPoint() { - OSL_PRECOND( m_refCount == 0, "OWeakObject::disposeWeakConnectionPoint: only to be called with a ref count of 0!" ); + OSL_PRECOND( (atomic_thread_fence(std::memory_order_acquire), m_refCount == 0), "OWeakObject::disposeWeakConnectionPoint: only to be called with a ref count of 0!" ); if (m_pWeakConnectionPoint != nullptr) { OWeakConnectionPoint * const p = m_pWeakConnectionPoint; m_pWeakConnectionPoint = nullptr;