Merge pull request #57739 from raulsntos/fix-57503-3.x

[3.x] Attach mono thread before getting `nativeName` field
This commit is contained in:
Rémi Verschelde 2022-02-07 07:58:29 +01:00 committed by GitHub
commit c590da0527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -3032,6 +3032,8 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
CRASH_COND(!valid);
#endif
GD_MONO_SCOPE_THREAD_ATTACH;
if (native) {
String native_name = NATIVE_GDMONOCLASS_NAME(native);
if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) {
@ -3042,8 +3044,6 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
}
}
GD_MONO_SCOPE_THREAD_ATTACH;
Variant::CallError unchecked_error;
return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error);
}