On Thu, Dec 1, 2016 at 5:09 PM, Thomas Barusseau
<baruss.tho...@gmail.com> wrote:
> Hello,
> I'm having a hard time making this piece of code work. Basically, I need to
> take a node.js function (in this case : `process.emit()`),
> store it in a C++ class, and use it at runtime whenever a callback method is
> called.
> Here is the code :
> https://gist.github.com/Neph0/21bcfcebc23596f76defad0e743ec929
> And here is gdb's output :
> https://gist.github.com/Neph0/0e668d427e2788c54f3d9b744c9a7abc
> Could anyone help me with that? There's no doubt my code has stupid things
> in it.
> I've read a lot of documentation today but somehow I can't figure out some
> things and I'm stuck trying things without fully understanding
> the big picture...
> Thanks in advance.

>From your gist:

     Local<Context> context = isolate->GetCurrentContext();
context->Enter(); // /!\ SIGSEGV HAPPENS HERE /!\

I bet that context.IsEmpty() is true.  You could move this line up:

     Local<Function> lpe = Local<Function>::New(isolate, process_emit);

And then you can get its context with lpe->CreationContext().

One last word of advice: conditionally creating a new isolate when
Isolate::GetCurrent() returns NULL is not going to work.  Objects and
functions are intrinsically tied to the isolate that created them.

v8-users mailing list
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.

Reply via email to