Hi,
My goal is to call a JavaScript function from C++ with arguments. So I
have the code below.
********************************************************************************************************************************
// executeFunction_TEST is called by other thread
void executeFunction_TEST(){
v8::Locker lock(isolate);
HandleScope handle_scope(isolate);
Handle<v8::Value> value =
context->Global()->Get(String::NewFromUtf8(isolate,"test_function"));
if(value->IsFunction()){
Handle<v8::Function> func=
v8::Handle<v8::Function>::Cast(value);
Handle<Value> args[2];
args[0] = v8::String::NewFromUtf8(isolate,
"value1");
args[1] = v8::String::NewFromUtf8(isolate,
"value2");
Handle<Value> result =
func->Call(context->Global(), 2, args);
cout<<"test_function is called"<<endl;//execution
comes here without any problem
}
cout<<"[End of executeFunction_TEST]"<<endl; //I see this line
executed too
}///when the function exits, it crashes.
***************************************************************************************************************
The executeFunction_TEST is executed from an external thread. So I used
Locker for isolate. When ever executeFunction_TEST is
called JavaScript function is successfully called without any problem. But
when execution reaches at the end of executeFunction_TEST function, it
crashes with the following error;
#
# Fatal error in c:\libs\v8_shared\v8\src\api.h, line 554
# CHECK(blocks_.length() == 0) failed
#
I've searched the groups and people say it is because the handles are still
in use but function is trying to de-allocate them(There was no fix
mentioned). So how to make sure that to free the handles. But I'm not sure
how to fix this. Anybody has an idea on this?..Thanks.
--
--
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/d/optout.