Thanks for your reply. But I can't find any other conversations by searching with keywords such like "SetSecondPassCallback", "phantom handles".
If two Persistent handles refer to the same v8 object, weak callback will be called twice. So wrappable object will be double-deleted either using SetSecondPassCallback or not. 在 2018年7月24日星期二 UTC+8上午12:25:53,Zac Hansen写道: > > > there was a long conversation about this about a year ago, maybe you can > find it. it turned out to be pretty convoluted from what I remember. > > > On Monday, July 23, 2018 at 12:16:09 AM UTC-7, fengx...@gmail.com wrote: >> >> Hi, >> I noticed that chromium's sourcecode src/gin/wrappable.cc >> use SetSecondPassCallback to make wrappable object deleted, while node.js >> does not. So when is SetSecondPassCallback need to be used? what's the >> purpose of this api? >> >> I also find a related link >> <https://groups.google.com/forum/#!search/SetSecondPassCallback/pdfium-reviews/_p2uyyq11g8/bR6EBheP7hcJ> >> which >> says: >> >> "Phantom handles allow for freeing objects with one pass of GC. However, >> this means that by the time the callback is invoked, the v8 object >> already >> does no longer exist. To avoid accidential access to the dead object, >> there >> are now two callbacks, where the first must only reset the handle, and >> the >> second does the clean-up work. " >> >> It looks like if not use second pass callback, accidential access to the >> dead object will happen. what's the accidential access? Does the dead >> object means the v8 object or the wrappable object? >> > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.