Allow handlers list to be modifed while iterating
This commit is contained in:
parent
ac9bec3ed9
commit
d7bc92706d
|
@ -87,7 +87,9 @@ class GlobalEventsDispatcher:
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue