From 113bfcba9d2bd61e055de24df2a5809b72fdf3e0 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 23 Sep 2017 13:39:43 -0700 Subject: [PATCH] PyLinkNetworkCore: copy world.hooks before iterating This fixes a race condition where the order of PRIVMSG handlers could be changed as 'load ' runs, causing the load command to be processed multiple times. --- classes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes.py b/classes.py index 0750ab6..f8e3496 100644 --- a/classes.py +++ b/classes.py @@ -233,7 +233,7 @@ class PyLinkNetworkCore(structures.DeprecatedAttributesObject, structures.CamelC command, hook_cmd) # Iterate over registered hook functions, catching errors accordingly. - for hook_pair in world.hooks[hook_cmd]: + for hook_pair in world.hooks[hook_cmd].copy(): hook_func = hook_pair[1] try: log.debug('(%s) Calling hook function %s from plugin "%s"', self.name,