https://bugs.documentfoundation.org/show_bug.cgi?id=97144

            Bug ID: 97144
           Summary: DataRaces in WeakReferenceHelper
           Product: LibreOffice
           Version: 4.1.4.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: sdk
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 121948
  --> https://bugs.documentfoundation.org/attachment.cgi?id=121948&action=edit
Patch to fix the data races

We saw SEGVs in case a an object dies due to its refcount reaching 0, while at
the same in other thread the WeakReference referencing this object also gets
destructed.

We traced it down due to data races in weak.cxx
a) OWeakObject::disposeWeakConnectionPoint(): needs to take the weak mutex
before really accessing m_pWeakConnectionPoint member, because
m_pWeakConnectionPoint member might have been written by another thread some
time before (ie. assignment of WeakReference in another thread than
destruction)
b) WeakReferenceHelper::clear(): also needs to take the weak mutex before
accessing m_pImpl->m_XWeakConnectionPoint for the same reasons
c) OWeakConnectionPoint::dispose(): needs to clear m_pObject member so to
ensure that OWeakConnectionPoint::queryAdapted() doesn't try to increment the
ref count after it has been disposed.

The attached patch resolves our SEGVs.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to