Merge pull request #95676 from raulsntos/dotnet/clear-owner-order

C#: Destroy script before clearing owner
This commit is contained in:
Rémi Verschelde 2024-08-19 12:09:15 +02:00
commit 1ac1d03857
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2351,8 +2351,8 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
if (!ok) {
// Important to clear this before destroying the script instance here
instance->script = Ref<CSharpScript>();
instance->owner = nullptr;
p_owner->set_script_instance(nullptr);
instance->owner = nullptr;
return nullptr;
}