From 4be2f2bfc2d508dd4b90933fe226c7136e3501bf Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Sun, 15 Mar 2020 13:58:51 +0100 Subject: [PATCH] Cannot CallJS from listen --- src/AppWrapper.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/AppWrapper.h b/src/AppWrapper.h index 2a8a1db..ea373da 100644 --- a/src/AppWrapper.h +++ b/src/AppWrapper.h @@ -236,7 +236,8 @@ void uWS_App_listen(const FunctionCallbackInfo &args) { auto cb = [&args, isolate](auto *token) { /* Return a false boolean if listen failed */ Local argv[] = {token ? Local::Cast(External::New(isolate, token)) : Local::Cast(Boolean::New(isolate, false))}; - CallJS(isolate, Local::Cast(args[args.Length() - 1]), 1, argv); + /* Immediate call cannot be CallJS */ + Local::Cast(args[args.Length() - 1])->Call(isolate->GetCurrentContext(), isolate->GetCurrentContext()->Global(), 1, argv); }; /* Host is first, if present */