NonCopyablePersistentTraits: Set kResetInDestructor to true

11 views
Skip to first unread message

d.har...@googlemail.com

unread,
Dec 10, 2019, 11:28:35 AM12/10/19
to v8-dev
Is there any reason why NonCopyablePersistentTrait's kResetInDestructor is still set to false?  Can it be updated to true?

The comments seem to indicate that it would be switched at some time in the future (written 6 years ago).

And ~Persistent has a comment that the flag should always be true.

This primarily affects use cases which involve setting the Persistent to weak, as otherwise you can use Global which does reset in its destructor.  There if you have a class which holds a Persistent as a member, you end up with corruption unless you remember to explicitly call Reset in your own destructor.

Thanks,
Daryl.

d.har...@googlemail.com

unread,
Dec 10, 2019, 11:32:02 AM12/10/19
to v8-dev
Actually, you can still use Global with SetWeak, so we can just switch to that, but is there any harm in changing it anyway?  If there's no downside it would be good to switch it to avoid others running into the same issue over and over.
Reply all
Reply to author
Forward
0 new messages