In the code below I'm passing an instantiated object to be wrapped for use
in JS scripts. Execution of the program is terminating at the call to
templ->NewInstance (). I've tried preceding the call with a TryCatch but it
still terminates. I don't know why and don't know how to find out why. If I
call templ.IsEmpty() it returns false so it would seem the template is
being instantiated.
TIA.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::Context> global_context;
v8::Persistent<v8::ObjectTemplate> global_obj_template;
v8::Handle<v8::Object> wrap_obj (MyObject* obj) {
v8::HandleScope handle_scope;
if (g_request_template.IsEmpty ()) {
v8::Handle<v8::ObjectTemplate> raw_template = make_request_template
();
global_obj_template = v8::Persistent<v8::ObjectTemplate>::New (
global_context->GetIsolate (), raw_template
);
}
v8::Handle<v8::ObjectTemplate> templ = global_obj_template;
// Execution terminates in the call below
v8::Handle<v8::Object> result = templ->NewInstance();
// Never makes it here
v8::Handle<v8::External> req_ptr = v8::External::New(obj);
result->SetInternalField(0, req_ptr);
return handle_scope.Close(result);
}
--
--
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.