From bba306d414f1e81c979ae53271c022df08ef7388 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Mon, 15 Apr 2024 21:10:11 -0700 Subject: [PATCH] fix: remove callbacks properly in remove_callbacks_for_function() Like remove_current_script_callback just before, also remove from the ordered_callbacks_map to keep the callback map and ordered callback map in sync. --- modules/script_callbacks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/script_callbacks.py b/modules/script_callbacks.py index 74f41f09d..9059d4d93 100644 --- a/modules/script_callbacks.py +++ b/modules/script_callbacks.py @@ -448,6 +448,9 @@ def remove_callbacks_for_function(callback_func): for callback_list in callback_map.values(): for callback_to_remove in [cb for cb in callback_list if cb.callback == callback_func]: callback_list.remove(callback_to_remove) + for ordered_callback_list in ordered_callbacks_map.values(): + for callback_to_remove in [cb for cb in ordered_callback_list if cb.callback == callback_func]: + ordered_callback_list.remove(callback_to_remove) def on_app_started(callback, *, name=None):