Commit d7bc9270 authored by Philipp Hörist's avatar Philipp Hörist

Allow handlers list to be modifed while iterating

parent ac9bec3e
...@@ -87,7 +87,9 @@ def raise_event(self, event_name, *args, **kwargs): ...@@ -87,7 +87,9 @@ def raise_event(self, event_name, *args, **kwargs):
log.debug('%s Args: %s', event_name, str(args)) log.debug('%s Args: %s', event_name, str(args))
if event_name in self.handlers: if event_name in self.handlers:
node_processed = False node_processed = False
for _priority, handler in self.handlers[event_name]: # Iterate over a copy of the handlers list, so while iterating
# the original handlers list can be modified
for _priority, handler in list(self.handlers[event_name]):
try: try:
if handler(*args, **kwargs): if handler(*args, **kwargs):
return True return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment