-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: call base basic finalizer if none defined #1574
Conversation
napi-inl.h
Outdated
@@ -5023,6 +5023,11 @@ inline void ObjectWrap<T>::FinalizeCallback(node_api_nogc_env env, | |||
#endif | |||
|
|||
instance->Finalize(Napi::BasicEnv(env)); | |||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see how this fixes the existing, not used error, but does it also fix running some finalization that should have run before but would not have, or now call the method just to fix the not used error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but does it also fix running some finalization that should have run before but would not have
This is not the case. If the user defined their own MyClass::Finalize(BasicEnv)
, the constexpr (details::HasBasicFinalizer<T>::value)
would be true, and then call instance->Finalize(Napi::BasicEnv(env))
.
... now call the method just to fix the not used error
This is the case, so it is adding an inefficiency (perhaps the compiler optimizes it out)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My questions is to make sure the additional invocation is desired, if so good, sounds like we found a potential bug as well. If not I think we can just add a (void) env;
early in the function to mark it as used to address the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying the same solution you proposed adding (void) env;
on my local machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it worked well on my local machine.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1574 +/- ##
=======================================
Coverage 64.40% 64.40%
=======================================
Files 3 3
Lines 2003 2003
Branches 693 693
=======================================
Hits 1290 1290
Misses 146 146
Partials 567 567 ☔ View full report in Codecov by Sentry. |
I've started a single Jenkins v22 run to see if the fix works
|
The CI fail, but it seems to be systemec failure:
I try to launch new job. |
The CI is green now I try to launch it for all LTS and CI: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Looks like CIs are good. @NickNaso thanks for kicking those off and checking the solution. Going to land. |
Will check the regular node-addon ci tomorrow to confirm all locks good. @KevinEady, @NickNaso thanks for the quick work to get this addressed. |
Call no-op
ObjectWrap<T>::Finalize
if user does not provide aFinalizer
method.Fixes: #1573