Fixes wrong var used for clearing out subscribers in Event Manager - #1813
Merged
Azaezel merged 1 commit intoAug 13, 2026
Merged
Conversation
…m an event when a message is received. The old code used callback, but it's a stringTableEntry that's checked against 0/null, but an event should always have a callback anyways, so this check ultimately never did anything The problem was that in the event of leaning into event messaging's async handling - like with the spawn setup logic in BaseGame - if you didn't super strictly subscribe->remove, there wasn't any protection of doubling up if the logic went through re-entrancy With the change, we now check the same already-existing removeFlag, but now also check if our callDepth is 0, which means the event being checked isn't dealing with any nesting/holdout calls, so between that and the removeFlag, we contextually know it's safe to clear This prevents the above issue by actually cleaning out subscribers that were marked with removeFlag, instead of the erroneous check so they stay forever and can start doubling-up in the script formulation isn't quite correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes the var that's checked when we move to clear a subscriber from an event when a message is received.
The old code used callback, but it's a stringTableEntry that's checked against 0/null, but an event should always have a callback anyways, so this check ultimately never did anything.
The problem was that in the event of leaning into event messaging's async handling - like with the spawn setup logic in BaseGame - if you didn't super strictly subscribe->remove, there wasn't any protection of doubling up if the logic went through re-entrancy.
With the change, we now check the same already-existing removeFlag, but now also check if our callDepth is 0, which means the event being checked isn't dealing with any nesting/holdout calls, so between that and the removeFlag, we contextually know it's safe to clear.
This prevents the above issue by actually cleaning out subscribers that were marked with removeFlag, instead of the erroneous check so they stay forever and can start doubling-up in the script formulation isn't quite correct.