summaryrefslogtreecommitdiff
path: root/modules/mono/glue
diff options
context:
space:
mode:
authorRaul Santos <raulsntos@gmail.com>2021-12-23 03:13:31 +0100
committerRaul Santos <raulsntos@gmail.com>2021-12-23 03:15:57 +0100
commit1fdfc379b6230b7d3dac4f22c846c45e93cd596d (patch)
tree7c591e5bb44f5b8a60b37b74ec07cdbe0b077019 /modules/mono/glue
parent1906b59675ce807d3be35924a1b4338976061e0f (diff)
Fix `KeyValuePairAt` memory leak
Diffstat (limited to 'modules/mono/glue')
-rw-r--r--modules/mono/glue/collections_glue.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp
index e367ecb7d6..cb6680c244 100644
--- a/modules/mono/glue/collections_glue.cpp
+++ b/modules/mono/glue/collections_glue.cpp
@@ -237,10 +237,8 @@ int32_t godot_icall_Dictionary_KeyValuePairs(Dictionary *ptr, Array **keys, Arra
}
void godot_icall_Dictionary_KeyValuePairAt(Dictionary *ptr, int index, MonoObject **key, MonoObject **value) {
- Array *keys = godot_icall_Dictionary_Keys(ptr);
- Array *values = godot_icall_Dictionary_Values(ptr);
- *key = GDMonoMarshal::variant_to_mono_object(keys->get(index));
- *value = GDMonoMarshal::variant_to_mono_object(values->get(index));
+ *key = GDMonoMarshal::variant_to_mono_object(ptr->get_key_at_index(index));
+ *value = GDMonoMarshal::variant_to_mono_object(ptr->get_value_at_index(index));
}
void godot_icall_Dictionary_Add(Dictionary *ptr, MonoObject *key, MonoObject *value) {