diff options
Diffstat (limited to 'client/system')
| -rw-r--r-- | client/system/settings.gd | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/client/system/settings.gd b/client/system/settings.gd index 12b14857..14c6d0db 100644 --- a/client/system/settings.gd +++ b/client/system/settings.gd @@ -134,7 +134,8 @@ static func hook_changed(key: String, slot, callable: Callable): var slot_id = 0 if slot is Node: slot_id = slot.get_instance_id() - slot.tree_exiting.connect(_unhook_changed.bind(key, slot_id), CONNECT_ONE_SHOT) + if not slot.tree_exiting.is_connected(_unhook_changed): + slot.tree_exiting.connect(_unhook_changed.bind(slot_id), CONNECT_ONE_SHOT) elif slot is String: slot_id = slot.hash() else: @@ -143,8 +144,9 @@ static func hook_changed(key: String, slot, callable: Callable): if not change_hooks.has(key): change_hooks[key] = {} change_hooks[key][slot_id] = callable -static func _unhook_changed(key: String, slot_id: int): - change_hooks[key].erase(slot_id) +static func _unhook_changed(slot_id: int): + for key in change_hooks: + change_hooks[key].erase(slot_id) # slot: String | Node static func hook_changed_init(key: String, slot, callable: Callable): |