diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 653db1670ad8..408573f84d36 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2617,6 +2617,12 @@ void _Thread::_start_func(void *ud) { Ref<_Thread> *tud = (Ref<_Thread> *)ud; Ref<_Thread> t = *tud; memdelete(tud); + + Object *target_instance = ObjectDB::get_instance(t->target_instance_id); + if (!target_instance) { + ERR_FAIL_MSG(vformat("Could not call function '%s' on previously freed instance to start thread %s.", t->target_method, t->get_id())); + } + Variant::CallError ce; const Variant *arg[1] = { &t->userdata }; int argc = 0; @@ -2635,15 +2641,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