mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Fix connection errors when replacing node
- Avoid connecting the signals to nonexistent methods
- Preserve only persistent connections
(cherry picked from commit d210ac66ef)
This commit is contained in:
committed by
Rémi Verschelde
parent
f8db8a3faa
commit
94653f0e88
@@ -1795,8 +1795,11 @@ void Node::_replace_connections_target(Node *p_new_target) {
|
||||
|
||||
Connection &c = E->get();
|
||||
|
||||
c.source->disconnect(c.signal, this, c.method);
|
||||
c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user