Fix connection errors when replacing node
- Avoid connecting the signals to nonexistent methods - Preserve only persistent connections
This commit is contained in:
parent
b043f0e77d
commit
d210ac66ef
|
@ -2498,9 +2498,12 @@ void Node::_replace_connections_target(Node *p_new_target) {
|
|||
|
||||
Connection &c = E->get();
|
||||
|
||||
if (c.flags & CONNECT_PERSIST) {
|
||||
c.source->disconnect(c.signal, this, c.method);
|
||||
ERR_CONTINUE(!p_new_target->has_method(c.method));
|
||||
c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector<Variant> Node::make_binds(VARIANT_ARG_DECLARE) {
|
||||
|
|
Loading…
Reference in New Issue