[Webkit-unassigned] [Bug 238871] Multiple uses of ThreadSafeRefCounted and CanMakeWeakPtr with non-thread-safe WeakPtr

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 6 09:33:22 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=238871

--- Comment #2 from Chris Dumez <cdumez at apple.com> ---
Not that in general, it is perfectly OK for a class to subclass ThreadSafeRefCounted and CanMakeWeakPtr and it is not indicative of a bug. It really depends on how you're using WeakPtr.

E.g., the following case is pretty common in WebKit:
1. We have an object A that gets constructed and destroyed on the main thread.
2. We sometimes pass object A to a background thread T and then back to the main thread.

It is OK as long as you only check the WeakPtr on the main thread and make sure that the object is always destroyed on the main thread.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220406/56ad5c7c/attachment.htm>


More information about the webkit-unassigned mailing list