-
Notifications
You must be signed in to change notification settings - Fork 36
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: event-handler leakage #788
Conversation
Fixes an issue where event handlers could be leaked if the same handler reference was added twice to different events Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
It occurred to me this fix is incomplete. It still possible to add the same handler to the same event twice and lose the first ref. I have another fix in mind. Marked as draft for now |
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Hey @beeme1mr @lukas-reining please re-review. As mentioned here, we also need to support the addition and removal of duplicate handlers to the same event. This is done by making the weakmap values arrays, and appending/popping them (this is consistent with how nodes event handlers work). I've added this functionality, and 2 relevant tests. |
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
🤖 I have created a release *beep* *boop* --- ## [0.0.24](core-v0.0.23...core-v0.0.24) (2024-01-27) ### ✨ New Features * adds ErrorOptions to Error constructor ([#765](#765)) ([2f59a9f](2f59a9f)) ### 🐛 Bug Fixes * event-handler leakage ([#788](#788)) ([69c7f05](69c7f05)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com> Signed-off-by: openfeature-peer-update-bot <openfeature-peer-update-bot@openfeature.dev> Co-authored-by: openfeature-peer-update-bot <openfeature-peer-update-bot@openfeature.dev>
Fixes an issue where event handlers could be leaked if the same handler reference was added multiple times.