From 22f59a0612d7e6b882c68fdbe3e6764739680cdf Mon Sep 17 00:00:00 2001 From: blagoev Date: Mon, 16 Nov 2020 23:09:02 +0200 Subject: [PATCH 1/2] create a HandleScope in FinalizeCallback --- napi-inl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/napi-inl.h b/napi-inl.h index 5866fd89c..2a175f9dd 100644 --- a/napi-inl.h +++ b/napi-inl.h @@ -3977,6 +3977,8 @@ inline napi_value ObjectWrap::StaticSetterCallbackWrapper( template inline void ObjectWrap::FinalizeCallback(napi_env env, void* data, void* /*hint*/) { + HandleScope scope(env); + T* instance = static_cast(data); instance->Finalize(Napi::Env(env)); delete instance; From 149602e7f5747bd4ce2e5753ab6ae52538f0e20d Mon Sep 17 00:00:00 2001 From: blagoev Date: Tue, 17 Nov 2020 11:31:46 +0200 Subject: [PATCH 2/2] guess what clang-format is not happy about --- napi-inl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/napi-inl.h b/napi-inl.h index 2a175f9dd..ab7ece1c8 100644 --- a/napi-inl.h +++ b/napi-inl.h @@ -3978,7 +3978,6 @@ inline napi_value ObjectWrap::StaticSetterCallbackWrapper( template inline void ObjectWrap::FinalizeCallback(napi_env env, void* data, void* /*hint*/) { HandleScope scope(env); - T* instance = static_cast(data); instance->Finalize(Napi::Env(env)); delete instance;