Skip to content

Commit

Permalink
Merge pull request godotengine#57738 from raulsntos/fix-57503
Browse files Browse the repository at this point in the history
Attach mono thread before getting `nativeName` field
  • Loading branch information
neikeq authored Feb 7, 2022
2 parents 8aa4ed8 + 303f0c8 commit 481b05f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/mono/csharp_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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);
}
Expand Down

0 comments on commit 481b05f

Please sign in to comment.