> wrap->jsObject_ = Persistent<Object>(args.This());
> instead of
> wrap->jsObject_ = Persistent<Object>::New(args.This());
>
> I wonder what the use of the first constructor is?

Persistent handles automatically convert to plain Handles so you can do

  Persistent<Object> obj = ...;
  Handle<Object> hnd = obj;

This means that you may have a Handle value that you know is a
persistent handle.  In that case the first constructor can be used to
"cast" the handle back to a persistent handle

  Persistent<Object> re_obj = Persistent<Object>(hnd);

Unfortunately the constructor does not verify that the handle being
converted is a persistent handle, otherwise that would have caught the
issue with your code.


-- Christian

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to