From 5e7fda8de7ee8c11b0009a4e7f154807afa57903 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sat, 17 Aug 2024 04:04:57 +0200 Subject: [PATCH] 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. --- modules/mono/csharp_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 36c8a40ed9a..8bd0dd14bb3 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -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(); - instance->owner = nullptr; p_owner->set_script_instance(nullptr); + instance->owner = nullptr; return nullptr; }