diff options
author | Danil Alexeev <dalexeev12@yandex.ru> | 2024-11-01 02:28:21 +0300 |
---|---|---|
committer | Danil Alexeev <dalexeev12@yandex.ru> | 2024-11-04 22:41:56 +0300 |
commit | e379cc76e5e4cdba8393ed5988f12a6c46a77493 (patch) | |
tree | f963bebb30ca8160b2c8911c5d3e061bc5430aab /scene/main | |
parent | 1bffd6c73b44b85e5889f54e14b2193940cf5bb1 (diff) | |
download | redot-engine-e379cc76e5e4cdba8393ed5988f12a6c46a77493.tar.gz |
Core: Fix `Callable.get_bound_arguments{,_count}()` return incorrect data
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/node.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 8dc7b4a87c..5063f0d6d0 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -3055,11 +3055,12 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { if (copy && copytarget && E.callable.get_method() != StringName()) { Callable copy_callable = Callable(copytarget, E.callable.get_method()); if (!copy->is_connected(E.signal.get_name(), copy_callable)) { - int arg_count = E.callable.get_bound_arguments_count(); - if (arg_count > 0) { + int unbound_arg_count = E.callable.get_unbound_arguments_count(); + if (unbound_arg_count > 0) { + copy_callable = copy_callable.unbind(unbound_arg_count); + } + if (E.callable.get_bound_arguments_count() > 0) { copy_callable = copy_callable.bindv(E.callable.get_bound_arguments()); - } else if (arg_count < 0) { - copy_callable = copy_callable.unbind(-arg_count); } copy->connect(E.signal.get_name(), copy_callable, E.flags); } |