You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-26 15:46:23 +00:00
Attach mono thread before getting nativeName field
In order to access the `nativeName` constant field from a C# class, the
mono scope thread must be attached or the mono domain will be null.
(cherry picked from commit eddb99b9be)
This commit is contained in:
committed by
Rémi Verschelde
parent
ca67b2bce1
commit
e9f93155c6
@@ -3032,6 +3032,8 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
|
|||||||
CRASH_COND(!valid);
|
CRASH_COND(!valid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GD_MONO_SCOPE_THREAD_ATTACH;
|
||||||
|
|
||||||
if (native) {
|
if (native) {
|
||||||
String native_name = NATIVE_GDMONOCLASS_NAME(native);
|
String native_name = NATIVE_GDMONOCLASS_NAME(native);
|
||||||
if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) {
|
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;
|
Variant::CallError unchecked_error;
|
||||||
return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error);
|
return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user