I changed the code to:

........
 Persistent<Object> self = Persistent<Object>::New(args.Holder());
 self.MakeWeak(p, Point_Destroy);

 self->SetInternalField(0, External::New(p));
 return self;
}

 void Point_Destroy(Persistent<Object> self, void* parameter)
 {
 delete static_cast<Point*>(parameter);
 }

because in the previous version were some problems when I tested it
with the javascript file.

On 29 Sep., 04:05, Jacob Burbach <[EMAIL PROTECTED]> wrote:
> On Monday 22 September 2008 4:57:35 [EMAIL PROTECTED] wrote:
>
>
>
>
>
> > Thank you for the example.
> > I also use:
> >            ........
> >    Persistent<Object> self = Persistent<Object>::New(args.Holder());
> >    self.MakeWeak(0, Point_Destroy);
>
> >    self->SetInternalField(0, External::New(p));
> >    return self;
> > }
> > void Point_Destroy(Persistent<Object> self, void* parameter)
> > {
> >    Local<External> external = Local<External>::Cast(self-
>
> > >GetInternalField(0));
>
> >    delete static_cast<Point*>(external->Value());
> > }
>
> > but the "Point_Destroy" Function is never called. So when should it be
> > called in your example?
>
> > Thanks
> > bg
>
> The Point_Destroy function will be called by the garbage collector when there
> are no more references to the object.
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to