Skip to content
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

napi_remove_wrap() #269

Closed
gabrielschulhof opened this issue Jul 26, 2017 · 1 comment
Closed

napi_remove_wrap() #269

gabrielschulhof opened this issue Jul 26, 2017 · 1 comment

Comments

@gabrielschulhof
Copy link
Collaborator

We need to be able to remove a wrap previously applied with napi_wrap().

Observations:

For this to work we need to store the Reference in the External, not the void* because the Reference may be self-destroying or it may not be. Either way, we need to have the Reference for when somebody calls napi_remove_wrap().

We need to document that, if the reference was explicitly requested by calling napi_wrap() with a non-NULL result out-parameter then the reference will become invalid after a call to napi_remove_wrap().

Additionally the implementations of napi_remove_wrap() needs to convert a self-destroying Reference into a non-self-destroying one before destroying it and foremost of all we need to remove the weak reference so the void* explicitly detached from the object prototype does not get double-freed.

@gabrielschulhof
Copy link
Collaborator Author

Closing in favour of #266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant