Skip to content

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

Merged
KyleSanderson merged 1 commit into
masterfrom
issue912
Oct 28, 2018
Merged

KyleSanderson merged 1 commit into
masterfrom
issue912

Conversation

@KyleSanderson

@KyleSanderson KyleSanderson commented Oct 28, 2018 •

Copy link
Copy Markdown
Member

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.

@psychonic psychonic left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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