Hi
A little artificial example but illustrates a problem I'm having:
static v8::Handle<v8::Value> func(const v8::Arguments& args) {
if (args.IsConstructCall())
return v8::Undefined();
v8::Local<v8::Object> obj = args[0]->ToObject();
int* pThis = static_cast<int*>(v8::Local<v8::External>::Cast(obj-
>GetInternalField(0))->Value()); <-- CRASH
return v8::Undefined();
}
int a = 5;
v8::Handle<v8::ObjectTemplate> pt = v8::ObjectTemplate::New();
pt->SetCallAsFunctionHandler(func);
pt->SetInternalFieldCount(1);
v8::Handle<v8::Object> obj = pt->NewInstance();
obj->SetInternalField(0, v8::External::Wrap(&a));
g->Set(v8::String::New("myfunc"), obj);
V8RUN("myfunc(myfunc);");
I'm expecting to get in args[0] myfunc v8 object, but it is not the
case....
Thanks
Vlad
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users