diff options
| author | metamuffin <metamuffin@disroot.org> | 2025-10-09 00:14:43 +0200 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2025-10-09 00:14:43 +0200 |
| commit | e26c94fedb3d5b06d10e572d2f1797775bd285a5 (patch) | |
| tree | dd863b4373a3cc708f6486a4cb94be61b085bee1 /client/system | |
| parent | 02e319e506738ba39ee8edb96d11d6d91105d544 (diff) | |
| download | hurrycurry-e26c94fedb3d5b06d10e572d2f1797775bd285a5.tar hurrycurry-e26c94fedb3d5b06d10e572d2f1797775bd285a5.tar.bz2 hurrycurry-e26c94fedb3d5b06d10e572d2f1797775bd285a5.tar.zst | |
Fix double connected signals (close #441)
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): |