summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd/gd_mono_marshal.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-15 17:35:45 +0200
committerGitHub <noreply@github.com>2021-10-15 17:35:45 +0200
commitf113dc986332b0d7ea432793640af2cefb4110ed (patch)
treea521a4b175055471e954396dbe03ada2da605f9b /modules/mono/mono_gd/gd_mono_marshal.cpp
parent6fb06ec47ee720e99146b1fae171e4ae0463646e (diff)
parentba4a88eaed1c01bc768dba063cc87d5185b1a937 (diff)
Merge pull request #53627 from raulsntos/fix-list-marshal
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_marshal.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index 1247c80ebf..12d6ceb9be 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -1362,7 +1362,6 @@ Dictionary system_generic_dict_to_Dictionary(MonoObject *p_obj, [[maybe_unused]]
MonoObject *Array_to_system_generic_list(const Array &p_array, GDMonoClass *p_class, MonoReflectionType *p_elem_reftype) {
MonoType *elem_type = mono_reflection_type_get_type(p_elem_reftype);
- MonoClass *elem_class = mono_class_from_mono_type(elem_type);
String ctor_desc = ":.ctor(System.Collections.Generic.IEnumerable`1<" + GDMonoUtils::get_type_desc(elem_type) + ">)";
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
MonoObject *mono_object = mono_object_new(mono_domain_get(), p_class->get_mono_ptr());
ERR_FAIL_NULL_V(mono_object, nullptr);
- void *ctor_args[1] = { Array_to_mono_array(p_array, elem_class) };
+ GDMonoClass *godot_array_class = GDMonoUtils::Marshal::make_generic_array_type(p_elem_reftype);
+ MonoObject *godot_array = GDMonoUtils::create_managed_from(p_array, godot_array_class);
+
+ void *ctor_args[1] = { godot_array };
MonoException *exc = nullptr;
ctor->invoke_raw(mono_object, ctor_args, &exc);