cppuhelper/source/weak.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 6ebe316635b7d4a2d8a82f79cc99eab95b0aabff
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Sep 4 20:02:14 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Sep 5 09:58:55 2024 +0200

    tsan: data race
    
    Atomic write of size 4 at 0x7254000f5f08 by thread T38 (mutexes: write M0, 
write M1, write M2):
    0 configmgr::Access::acquireCounting()
    1 configmgr::Components::initGlobalBroadcaster(configmgr::Modifications 
const&, rtl::Reference<configmgr::RootAccess> const&, configmgr::Broadcaster*)
    2 configmgr::RootAccess::commitChanges()
    3 non-virtual thunk to configmgr::RootAccess::commitChanges()
    4 utl::OConfigurationTreeRoot::commit()
    5 dbaccess::(anonymous 
namespace)::DatabaseRegistrations::registerDatabaseLocation(rtl::OUString 
const&, rtl::OUString const&)
    6 non-virtual thunk to dbaccess::(anonymous 
namespace)::DatabaseRegistrations::registerDatabaseLocation(rtl::OUString 
const&, rtl::OUString const&)
    7 dbaccess::ODatabaseContext::registerDatabaseLocation(rtl::OUString 
const&, rtl::OUString const&)
    8 dbaccess::ODatabaseContext::registerObject(rtl::OUString const&, 
com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
    9 non-virtual thunk to 
dbaccess::ODatabaseContext::registerObject(rtl::OUString const&, 
com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
    10 gcc3::callVirtualMethod(void*, unsigned int, void*, 
_typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, 
unsigned long*, double*)
    
    Previous read of size 4 at 0x7254000f5f08 by main thread (mutexes: write 
M3, write M4):
    0 cppu::OWeakObject::disposeWeakConnectionPoint()
    1 cppu::OWeakObject::release()
    2 configmgr::RootAccess::release()
    3 non-virtual thunk to configmgr::RootAccess::release()
    4 
com::sun::star::uno::Reference<com::sun::star::util::XChangesBatch>::~Reference()
    5 SvtLinguConfig::~SvtLinguConfig()
    6 SwDoc::GetGCIterator()
    7 SwDoc::StartGrammarChecking(bool)
    8 sw::DocumentTimerManager::GetNextIdleJob()
    9 sw::DocumentTimerManager::IsDocIdle()
    10 sw::SwDocIdle::UpdateMinPeriod(unsigned long) const
    11 Scheduler::CallbackTaskScheduling()
    
    Change-Id: Idaf2707e5902338a873a325228e9c97e646ea768
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172874
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

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 <com/sun/star/lang/DisposedException.hpp>
 
+#include <atomic>
 #include <algorithm>
 #include <vector>
 #include <mutex>
@@ -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;

Reply via email to