Hi,

I have the following callback definition.

void Callback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
string strLogLine = "";
v8::Isolate* pIsolate = info.GetIsolate();


for (int i = 0; i < info.Length(); i++)
{
strLogLine += " " + 
string(*(v8::String::Utf8Value(info[i]->ToString(pIsolate))));
}

Log('i', strLogLine);
}

It worked fine, till today.
The callback is still called, but it crashes.
because the Utf8Value internally calls the Isolate::GetCurrent(), which 
returns NULL. (check failed: isolate != NULL)

Can someone tell me in what cases the Isolate::GetCurrent() will return 
NULL, and more precisely inside a callback function?


the function to execute javascript, which will trigger the callback


v8::Local<v8::Value> CScriptContext::ExecuteScript(const ustring & 
strExpression, bool & bResult)
{
//Local variables
v8::Local<v8::Value> Result;


v8::Locker lock(m_pIsolate); // v8::Isolate * m_pIsolate

v8::EscapableHandleScope handle_scope(m_pIsolate);

v8::Local<v8::Context> Context = m_pContext->Get(m_pIsolate); // 
v8::Persistent<v8::Context> m_pContext

v8::Context::Scope contextScope(Context);

v8::Local<v8::String> source =
v8::String::NewFromUtf8(m_pIsolate, strExpression.c_str());
v8::MaybeLocal<v8::Script> script = v8::Script::Compile(Context, source);

if (!script.IsEmpty())
{
v8::Local<v8::Script> v8LocalScript = script.ToLocalChecked();
Result = v8LocalScript->Run();

if (Result.IsEmpty()) {
VoxLog(M, 'W', F, L, "[JS][ScriptContext][ExecuteScript] result of the 
executed script is empty");
bResult = false;
}
else
{
bResult = true;
}
}
else
{

bResult = false;
}
return handle_scope.Escape(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/d/optout.

Reply via email to