From d7bc92706da5b835594629daad520d17c4f7997f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 18 Dec 2018 14:08:27 +0100 Subject: [PATCH] Allow handlers list to be modifed while iterating --- gajim/common/ged.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gajim/common/ged.py b/gajim/common/ged.py index ffa206e4e..157e3f54c 100644 --- a/gajim/common/ged.py +++ b/gajim/common/ged.py @@ -87,7 +87,9 @@ class GlobalEventsDispatcher: log.debug('%s Args: %s', event_name, str(args)) if event_name in self.handlers: 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: if handler(*args, **kwargs): return True