On Thu, Nov 20, 2014 at 12:48 AM, Robert Jenks <rje...@universalbits.com> wrote: > I am working to update Jav8 to the latest V8 APIs and get it working on > Windows 32bit. I am not the maintainer, but I have been unable to contact > them and need this working. > > I am having a problem creating a second Isolate. The first one works fine, > but I get a crash when trying to initialize the second one. Here is the > error: > > > > # > # Fatal error in v8::HandleScope::CreateHandle() > # Cannot create a handle without a HandleScope > # > > The error occurs at: > Context::global_object() ("this" is NULL) > Context::native_context() > Isolate::native_context() > Execution::InstantiateFunction() > Execution::InstantiateObject() > ObjectTemplate::NewInstance() > env.Wrap() (See call below) > > > > Here is the init code that runs when the Jav8 DLL is loaded > > jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) > { > v8::V8::InitializeICU(); > v8::Platform* platform = v8::platform::CreateDefaultPlatform(); > v8::V8::InitializePlatform(platform); > v8::V8::Initialize(); > > return JNI_VERSION_1_2; > } > > > Here is the code that runs to create and init a new Isolate: > > jlong JNICALL Java_lu_flier_script_V8Context_internalCreateContext(JNIEnv > *pEnv, jobject pObj) > { > jni::Jav8Context* jav8Context = new jni::Jav8Context(); > v8::Isolate* isolate = jav8Context->GetIsolate(); > v8::Isolate::Scope isolateScope(isolate); > v8::HandleScope handleScope(isolate); > v8::Handle<v8::Context> ctxt = v8::Local<v8::Context>::New(isolate, > *jav8Context->GetContext()); > jni::V8Env env(pEnv, jav8Context); > ctxt->Global()->Set(v8::String::NewFromUtf8(isolate, "__proto__"), > env.Wrap(pObj)); > return PTR_TO_JLONG(jav8Context); > } > > > That code uses the following class for some of the init: > > class Jav8Context { > public: > Jav8Context() { > // Create a new Isolate and make it the current one. > isolate_ = v8::Isolate::New(); > v8::Isolate::Scope isolateScope(isolate_); > isolate_->Enter(); > v8::HandleScope handleScope(isolate_); > v8::Handle<v8::Context> ctxt = v8::Context::New(isolate_); > ctxt->Enter(); > context_ = new v8::Persistent<v8::Context>(isolate_, ctxt); > } > ~Jav8Context() { > context_->Reset(); > isolate_->Exit(); > isolate_->Dispose(); > } > v8::Isolate* GetIsolate() {return isolate_;} > v8::Persistent<v8::Context>* GetContext() {return context_;} > private: > v8::Isolate* isolate_; > v8::Persistent<v8::Context>* context_; > }; > > > Any advice would be greatly appreciated.
Can you post the source of V8Env? The stack trace suggests the issue is with V8Env::Wrap(). Does the stack trace always originate from Java_lu_flier_script_V8Context_internalCreateContext()? -- -- v8-users mailing list v8-users@googlegroups.com 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 v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.