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

Fix mtx_do_lock on exit or reload context #170

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

julianmesa-gitkraken
Copy link
Contributor

@julianmesa-gitkraken julianmesa-gitkraken commented Nov 18, 2022

We made an effort to try using AddCleanupHook to stop the watcher on all NSFW instances when exiting from a worker or electron context, but in the end we couldn’t make it work correctly, so we had to stop using them.
The reason is that using CleanupHooks introduces a problem: if you create and free a NSFW object when you close o reload a context or worker the CleanupHook will be triggered on an already freed object, so you will get a crash. We have tried to remove the CleanupHook before that, but you will get a crash if you try to remove it in the destructor. You cannot create or remove a CleanupHook anywhere you want, you can only do it when you have access to Napi::env directly in the call, and you cannot store it to use it later in the destructor.

@julianmesa-gitkraken
Copy link
Contributor Author

To use cleanuphooks again we need this PR merged.

@ianhattendorf ianhattendorf merged commit 2da89e1 into Axosoft:master Dec 2, 2022
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

Successfully merging this pull request may close these issues.

2 participants