summaryrefslogtreecommitdiff
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorIgnacio Roldán Etcheverry <neikeq@users.noreply.github.com>2022-02-07 04:58:16 +0100
committerGitHub <noreply@github.com>2022-02-07 04:58:16 +0100
commit481b05fef1918aed9cee47680cb55b997acc5daa (patch)
treed9cb604c6c16ac5c7bfeca28e5a28dc8a5d4f1ad /modules/mono/csharp_script.cpp
parent8aa4ed8b5b22881661f1355cf90871c4e25c68e2 (diff)
parent303f0c8626aea2aef21a70a1598f689ee4e16b0d (diff)
Merge pull request #57738 from raulsntos/fix-57503
Attach mono thread before getting `nativeName` field
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 26436e3ec0..085ab9a467 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -3245,6 +3245,8 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
CRASH_COND(!valid);
#endif
+ GD_MONO_SCOPE_THREAD_ATTACH;
+
if (native) {
StringName native_name = NATIVE_GDMONOCLASS_NAME(native);
if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) {
@@ -3257,8 +3259,6 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
}
}
- GD_MONO_SCOPE_THREAD_ATTACH;
-
Callable::CallError unchecked_error;
return _create_instance(nullptr, 0, p_this, Object::cast_to<RefCounted>(p_this) != nullptr, unchecked_error);
}