Subject: | segmentation fault when context used after destroying |
Test case script:
----------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use JavaScript::V8;
my $context = JavaScript::V8::Context->new();
my @savecontext = ();
my $inside = sub {
my $context2 = JavaScript::V8::Context->new();
#push @savecontext, $context2;
return $context2->eval("obj = { dieperl : function() { return {} } }");
};
$context->bind( inside => $inside );
$context->eval("x = inside(); x.dieperl()");
die $@ if ($@);
----------------------------------
$ gdb --args perl testcase
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff65fb16a in v8::Context::Enter() () from
/usr/lib64/libv8.so.3.9.19
After execution of inside() $context2 was destroyed and execution code
from that context results SIGSEGV.
If context is saved into current scope (uncomment line `push
@savecontext, $context2;`) than all run ok.
Can't decide is it bug or feature? )