Skip to content

Commit

Permalink
fix: call base basic finalizer if none defined (#1574)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
KevinEady authored Sep 5, 2024
1 parent 600fe6c commit 294a43f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5011,6 +5011,10 @@ template <typename T>
inline void ObjectWrap<T>::FinalizeCallback(node_api_nogc_env env,
void* data,
void* /*hint*/) {
// If the child class does not override _any_ Finalize() method, `env` will be
// unused because of the constexpr guards. Explicitly reference it here to
// bypass compiler warnings.
(void)env;
T* instance = static_cast<T*>(data);

// Prevent ~ObjectWrap from calling napi_remove_wrap
Expand Down

0 comments on commit 294a43f

Please sign in to comment.