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

SDKHooks: Reset global hookid when unhooking in SH. #916

Merged
merged 1 commit into from
Oct 28, 2018
Merged

Conversation

KyleSanderson
Copy link
Member

@KyleSanderson KyleSanderson commented Oct 28, 2018

This is an ancient bug in SDKHooks (I actually mailed PM about it before I knew better) where we don't reset the global hookids when we unhook functions. This results in double-frees and oddness when the last users of these forwards unload; and the same or new user comes into the fold using the forward again.

This fixes #912
This is also untested.

Copy link
Member

@psychonic psychonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@KyleSanderson KyleSanderson merged commit cb8d92e into master Oct 28, 2018
@KyleSanderson KyleSanderson deleted the issue912 branch October 28, 2018 18:07
@asherkin
Copy link
Member

Other than possibly being a bit surprising, is there any reason for SH_REMOVE_HOOK_ID not to do this itself?

@KyleSanderson
Copy link
Member Author

Other than possibly being a bit surprising, is there any reason for SH_REMOVE_HOOK_ID not to do this itself?

While internally I think we'd be okay this could subtly break plugins if they're storing hookids elsewhere. This would only be an issue on recompilation; but I think it's too late to change this behaviour now (and I like it better as-is, anyways).

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.

SDKHooks: OnLevelInit stops being called when the last registered plugin is reloaded
3 participants