[Webkit-unassigned] [Bug 199857] [WTF] Thread::removeFromThreadGroup leaks weak pointers.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 9 10:41:03 PDT 2019


--- Comment #14 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 375899
  --> https://bugs.webkit.org/attachment.cgi?id=375899

View in context: https://bugs.webkit.org/attachment.cgi?id=375899&action=review

>> Source/WTF/wtf/Threading.h:296
>> +    HashMap<ThreadGroup*, std::weak_ptr<ThreadGroup>> m_threadGroupMap;
> Future cleanup thought: Can we make HashSet<std::weak_ptr<ThreadGroup>> work for a case like this, rather than requiring use of a map?

Yeah, I would like to make this too :D
Unfortunately, currently, `std::weak_ptr` does not have a way to get a raw pointer if the held object is dead (I would like to have `std::weak_ptr::get()`...).
So we need our own WeakPtr implementation which is thread-safe and having a method (like WeakPtr::getRaw()) returning an original pointer regardless of liveness (thread-safe weak pointer is why we are using std::weak_ptr and std::shared_ptr instead of RefPtr and WeakPtr here).

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/20190809/e3d3bfb0/attachment.html>

More information about the webkit-unassigned mailing list