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

Remove listener if one already exists #101

Merged
merged 1 commit into from
Dec 18, 2023
Merged

Remove listener if one already exists #101

merged 1 commit into from
Dec 18, 2023

Conversation

notgull
Copy link
Member

@notgull notgull commented Dec 16, 2023

This commit makes it so EventListener::listen() does not overwrite
existing listeners if they already exist. If the listener is already
registered in an event listener list, it removes the listener from that
list before registering the new listener. This soundness bug was missed
during #94.

This is a patch-compatible fix for #100. We may also want an API-level
fix for #100 as well. This is up for further discussion.

@notgull
Copy link
Member Author

notgull commented Dec 16, 2023

Slight benchmark regression, but it's fine for now

image

This commit makes it so EventListener::listen() does not overwrite
existing listeners if they already exist. If the listener is already
registered in an event listener list, it removes the listener from that
list before registering the new listener. This soundness bug was missed
during #94.

This is a patch-compatible fix for #100. We may also want an API-level
fix for #100 as well. This is up for further discussion.

Signed-off-by: John Nunley <dev@notgull.net>
@notgull notgull merged commit c2d1ccb into master Dec 18, 2023
9 checks passed
@notgull notgull deleted the eyepatch branch December 18, 2023 15:28
This was referenced Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant