summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-06-17 13:35:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-17 15:27:46 +0000
commit2051d7b849105c2020887635e18687c30cdc88c7 (patch)
treeab0ab505bb3b20045f483c90d60c3a13ac4146c2 /include
parenta9593e8db116edd000a7a19f7d83256474faed6f (diff)
cppuhelper: WeakReference isn't thread-safe
... but its documentation claims that it is, which is partially misleading, so fix both the documentation and the data race in WeakReferenceHelper::clear(). This actually crashed in clear() in the multi-threaded ZipPackage code on exporting the bugdoc from tdf#94212, presumably because clear() races against OWeakRefListener::dispose(). (cherry picked from commit debe788bcf3ec258b6b95df3db1f7bfeba881be1) Change-Id: I85665c11b8157e90d15e8263758e24e66efeb86c Reviewed-on: https://gerrit.libreoffice.org/26427 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/cppuhelper/weakref.hxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/include/cppuhelper/weakref.hxx b/include/cppuhelper/weakref.hxx
index 458bd9306706..f8ea369e1473 100644
--- a/include/cppuhelper/weakref.hxx
+++ b/include/cppuhelper/weakref.hxx
@@ -39,8 +39,14 @@ namespace uno
class OWeakRefListener;
-/** The WeakReferenceHelper holds a weak reference to an object. This object must implement
- the css::uno::XWeak interface. The implementation is thread safe.
+/** The WeakReferenceHelper holds a weak reference to an object.
+
+ This object must implement the css::uno::XWeak interface.
+
+ The WeakReferenceHelper itself is *not* thread safe, just as
+ Reference itself isn't, but the implementation of the listeners etc.
+ behind it *is* thread-safe, so multiple threads can have their own
+ WeakReferences to the same XWeak object.
*/
class CPPUHELPER_DLLPUBLIC WeakReferenceHelper
{
@@ -113,8 +119,14 @@ protected:
/// @endcond
};
-/** The WeakReference<> holds a weak reference to an object. This object must implement
- the css::uno::XWeak interface. The implementation is thread safe.
+/** The WeakReference<> holds a weak reference to an object.
+
+ This object must implement the css::uno::XWeak interface.
+
+ The WeakReference itself is *not* thread safe, just as
+ Reference itself isn't, but the implementation of the listeners etc.
+ behind it *is* thread-safe, so multiple threads can have their own
+ WeakReferences to the same XWeak object.
@tparam interface_type type of interface
*/