From ebe008d41b112880ebac555ac7305de6b8a0b432 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sat, 27 Aug 2022 17:18:13 +0200 Subject: C#: Fix byteCount in `NativeMemory.Alloc` `NativeMemory.Alloc` takes the byte count as parameter, this is calculated by multiplying the element size in bytes by the length of the array. --- .../glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/mono') diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs index 0dc5ba7678..3884781988 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs @@ -831,7 +831,7 @@ namespace Godot.Bridge } else { - interopProperties = ((godotsharp_property_info*)NativeMemory.Alloc((nuint)length))!; + interopProperties = ((godotsharp_property_info*)NativeMemory.Alloc((nuint)length, (nuint)sizeof(godotsharp_property_info)))!; } try @@ -951,7 +951,7 @@ namespace Godot.Bridge } else { - interopDefaultValues = ((godotsharp_property_def_val_pair*)NativeMemory.Alloc((nuint)length))!; + interopDefaultValues = ((godotsharp_property_def_val_pair*)NativeMemory.Alloc((nuint)length, (nuint)sizeof(godotsharp_property_def_val_pair)))!; } try -- cgit v1.2.3