On Fri, Apr 12, 2019 at 4:32 PM Al Mo <almos...@gmail.com> wrote:
> On some place in my code I get a reference to a local v8::Function like this:
>
> v8::Persistent<v8::Value>& VALUE;
>
> v8::Local<v8::Function> FUNCTION = v8::Local<v8::Function>::Cast(VALUE);
>
> Then I call it like:
>
> FUNCTION->Call(v8::Undefined(this->isolate), 0, NULL);
>
> "0" and "NULL" since I don't need args at this moment.
>
> For some reason, I can only call it once (the callback gets called once on my 
> JS code).
>
> If I call it more than one time, like:
>
> FUNCTION->Call(v8::Undefined(this->isolate), 0, NULL);
> FUNCTION->Call(v8::Undefined(this->isolate), 0, NULL);
> FUNCTION->Call(v8::Undefined(this->isolate), 0, NULL);
> FUNCTION->Call(v8::Undefined(this->isolate), 0, NULL);
>
> Only the first calls suceeds, the other ones do not throw an error but also 
> "do nothing". After this, my stack is corrupted.
>
> Is there something I don't know about the calling convention that could 
> explain this? (Perhaps a function instance is meant to only be called one?)
>
> Or should I dive into my code as I may be the one causing the problem ... ?

Are you sure FUNCTION is properly rooted in a HandleScope?

Can you reproduce in a debugger and if so, does the FUNCTION.val_
field change value between calls?

-- 
-- 
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.

Reply via email to