Explorar o código

Let thread func have optional parameter

Fixes #38042.
Faymoon %!s(int64=5) %!d(string=hai) anos
pai
achega
78ead60372
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      core/core_bind.cpp

+ 2 - 1
core/core_bind.cpp

@@ -1729,10 +1729,11 @@ void _Thread::_start_func(void *ud) {
 	memdelete(tud);
 	memdelete(tud);
 	Callable::CallError ce;
 	Callable::CallError ce;
 	const Variant *arg[1] = { &t->userdata };
 	const Variant *arg[1] = { &t->userdata };
+	int argc = (int)(arg[0]->get_type() != Variant::NIL);
 
 
 	Thread::set_name(t->target_method);
 	Thread::set_name(t->target_method);
 
 
-	t->ret = t->target_instance->call(t->target_method, arg, 1, ce);
+	t->ret = t->target_instance->call(t->target_method, arg, argc, ce);
 	if (ce.error != Callable::CallError::CALL_OK) {
 	if (ce.error != Callable::CallError::CALL_OK) {
 		String reason;
 		String reason;
 		switch (ce.error) {
 		switch (ce.error) {