diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 0b9816932cb3..f630adc39eeb 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -1768,6 +1768,12 @@ void Thread::_start_func(void *ud) { Ref *tud = (Ref *)ud; Ref t = *tud; memdelete(tud); + + Object *target_instance = t->target_callable.get_object(); + if (!target_instance) { + ERR_FAIL_MSG(vformat("Could not call function '%s' on previously freed instance to start thread %s.", t->target_callable.get_method(), t->get_id())); + } + Callable::CallError ce; const Variant *arg[1] = { &t->userdata }; int argc = 0; @@ -1786,15 +1792,17 @@ void Thread::_start_func(void *ud) { // We must check if we are in case b). int target_param_count = 0; int target_default_arg_count = 0; - Ref