Skip to content

Commit f113dc9

Browse files
authored
Merge pull request #53627 from raulsntos/fix-list-marshal
2 parents 6fb06ec + ba4a88e commit f113dc9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/mono/mono_gd/gd_mono_marshal.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,6 @@ Dictionary system_generic_dict_to_Dictionary(MonoObject *p_obj, [[maybe_unused]]
13621362

13631363
MonoObject *Array_to_system_generic_list(const Array &p_array, GDMonoClass *p_class, MonoReflectionType *p_elem_reftype) {
13641364
MonoType *elem_type = mono_reflection_type_get_type(p_elem_reftype);
1365-
MonoClass *elem_class = mono_class_from_mono_type(elem_type);
13661365

13671366
String ctor_desc = ":.ctor(System.Collections.Generic.IEnumerable`1<" + GDMonoUtils::get_type_desc(elem_type) + ">)";
13681367
GDMonoMethod *ctor = p_class->get_method_with_desc(ctor_desc, true);
@@ -1371,7 +1370,10 @@ MonoObject *Array_to_system_generic_list(const Array &p_array, GDMonoClass *p_cl
13711370
MonoObject *mono_object = mono_object_new(mono_domain_get(), p_class->get_mono_ptr());
13721371
ERR_FAIL_NULL_V(mono_object, nullptr);
13731372

1374-
void *ctor_args[1] = { Array_to_mono_array(p_array, elem_class) };
1373+
GDMonoClass *godot_array_class = GDMonoUtils::Marshal::make_generic_array_type(p_elem_reftype);
1374+
MonoObject *godot_array = GDMonoUtils::create_managed_from(p_array, godot_array_class);
1375+
1376+
void *ctor_args[1] = { godot_array };
13751377

13761378
MonoException *exc = nullptr;
13771379
ctor->invoke_raw(mono_object, ctor_args, &exc);

0 commit comments

Comments
 (0)