Skip to content

Commit 0401a2d

Browse files
authored
src: fix external reference registration for new CFunction lifetime
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/7828135 Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com> PR-URL: #63679 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 93ab3c7 commit 0401a2d

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/node_external_reference.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class ExternalReferenceRegistry {
4242
// Registers both the underlying function pointer
4343
// and the corresponding CFunctionInfo.
4444
void Register(const v8::CFunction& c_func) {
45+
RegisterT(&c_func);
46+
// TODO(joyeecheung): remove below when V8 14.8 lands.
4547
RegisterT(c_func.GetAddress());
4648
RegisterT(c_func.GetTypeInfo());
4749
}

src/node_wasi.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
234234
template <typename FT, FT F, typename R, typename... Args>
235235
void WASI::WasiFunction<FT, F, R, Args...>::SetFunction(
236236
Environment* env, const char* name, Local<FunctionTemplate> tmpl) {
237-
auto c_function = CFunction::Make(FastCallback);
237+
static auto c_function = CFunction::Make(FastCallback);
238238
Local<FunctionTemplate> t =
239239
FunctionTemplate::New(env->isolate(),
240240
SlowCallback,

0 commit comments

Comments
 (0)