C#: Destroy script before clearing owner

The C# script destructor needs to access the owner (i.e.: to disconnect signals) so we now clear it after the script has been destroyed.
This commit is contained in:
Raul Santos 2024-08-17 04:04:57 +02:00
parent ee363af0ed
commit 5e7fda8de7
No known key found for this signature in database
GPG Key ID: B532473AE3A803E4
1 changed files with 1 additions and 1 deletions

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;
}