On Friday, August 23, 2013 12:12:31 AM UTC+2, Jim Acquavella wrote: > Why can't the Persistent use a RIAA pattern that's reference counted? > Ideally, I'd like to create a persistent, copy it to another persistent > (which would increment the reference), then the last one to go out of scope > should be disposed automatically in the destructor. In other words, I'd > like to use it like a boost::shared_ptr. > > This is one of the ideas that we've discussed internally. The problem is that persistent carries a lot of state with it, and that state is not generally amenable to reference counting. A weak handle that is reference counted is particularly problematic, for instance, since most weak callbacks dispose the handle, leaving any references to it invalid. Unless you can find all copies of the handle out there, you've got a use after free bug waiting for you.
It's much better to write a wrapper class for refcounted persistents if your application demands it. -- -- v8-users mailing list [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
