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

EventContainer scope event removal #172

Open
NeonDaniel opened this issue Jun 26, 2023 · 1 comment
Open

EventContainer scope event removal #172

NeonDaniel opened this issue Jun 26, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@NeonDaniel
Copy link
Member

EventContainer already tracks events and callbacks added via the container; rather than removing all listeners on remove, it should remove specific callbacks that it manages.

@NeonDaniel
Copy link
Member Author

Current behavior (after removing specific events/handlers):

        # Because of function wrappers, the emitter doesn't always directly
        # hold the _handler function, it sometimes holds something like
        # 'wrapper(_handler)'.  So a call like:
        #     self.bus.remove(_name, _handler)
        # will not find it, leaving an event handler with that name left behind
        # waiting to fire if it is ever re-installed and triggered.
        # Remove all handlers with the given name, regardless of handler.
        if removed:
            self.bus.remove_all_listeners(name)

A better implementation would need to keep track of wrapped functions to more precisely remove only the handlers managed by this container

@JarbasAl JarbasAl added bug Something isn't working and removed enhancement New feature or request labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants