Skip to content

Commit 1c8bf43

Browse files
committed
src: fix external reference registration for new CFunction lifetime
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
1 parent db452d7 commit 1c8bf43

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/node_external_reference.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ 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.GetAddress());
46-
RegisterT(c_func.GetTypeInfo());
45+
RegisterT(&c_func);
4746
}
4847

4948
// This can be called only once.

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)