Skip to content

Commit 294a43f

Browse files
authored
fix: call base basic finalizer if none defined (#1574)
* use `env` value to avoid not use warning One path uses it and the other does not so we can't just flag it in the parameter. Use it in the path that does not currently use it in a way similar how this is handled in core Node.js
1 parent 600fe6c commit 294a43f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

napi-inl.h

+4
Original file line numberDiff line numberDiff line change
@@ -5011,6 +5011,10 @@ template <typename T>
50115011
inline void ObjectWrap<T>::FinalizeCallback(node_api_nogc_env env,
50125012
void* data,
50135013
void* /*hint*/) {
5014+
// If the child class does not override _any_ Finalize() method, `env` will be
5015+
// unused because of the constexpr guards. Explicitly reference it here to
5016+
// bypass compiler warnings.
5017+
(void)env;
50145018
T* instance = static_cast<T*>(data);
50155019

50165020
// Prevent ~ObjectWrap from calling napi_remove_wrap

0 commit comments

Comments
 (0)