Fix Error when connecting signal with unbinds not yet existing function

When a Signal with unbinds was connected to a non-existing function, the connection attempt was made before the function was created.

I moved the creation of the function in front of the connection attempt.
This commit is contained in:
Squamto
2025-01-31 19:22:35 +01:00
parent 0dd9178269
commit 096f0288ba

View File

@@ -1001,13 +1001,6 @@ void ConnectionsDock::_make_or_edit_connection() {
}
}
if (connect_dialog->is_editing()) {
_disconnect(connect_dialog->get_source_connection_data());
_connect(cd);
} else {
_connect(cd);
}
if (add_script_function_request) {
PackedStringArray script_function_args = connect_dialog->get_signal_args();
script_function_args.resize(script_function_args.size() - cd.unbinds);
@@ -1057,6 +1050,13 @@ void ConnectionsDock::_make_or_edit_connection() {
EditorNode::get_singleton()->emit_signal(SNAME("script_add_function_request"), target, cd.method, script_function_args);
}
if (connect_dialog->is_editing()) {
_disconnect(connect_dialog->get_source_connection_data());
_connect(cd);
} else {
_connect(cd);
}
update_tree();
}