1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Fix Thread crash when using invalid callback signature. And invalid message formatting.

This commit is contained in:
Pāvels Nadtočajevs
2025-04-09 11:57:25 +03:00
parent 4248411baf
commit 41a87f06e1

View File

@@ -1339,6 +1339,7 @@ void Thread::_start_func(void *ud) {
// When the call returns, we will reference the thread again if possible.
ObjectID th_instance_id = t->get_instance_id();
Callable target_callable = t->target_callable;
String id = t->get_id();
t = Ref<Thread>();
Callable::CallError ce;
@@ -1356,7 +1357,7 @@ void Thread::_start_func(void *ud) {
}
if (ce.error != Callable::CallError::CALL_OK) {
ERR_FAIL_MSG(vformat("Could not call function '%s' to start thread %d: %s.", func_name, t->get_id(), Variant::get_callable_error_text(t->target_callable, nullptr, 0, ce)));
ERR_FAIL_MSG(vformat("Could not call function '%s' to start thread %s: %s.", func_name, id, Variant::get_callable_error_text(target_callable, nullptr, 0, ce)));
}
}