瀏覽代碼

Merge pull request #64959 from raulsntos/dotnet/fix-malloc-size

C#: Fix byteCount in `NativeMemory.Alloc`
Ignacio Roldán Etcheverry 3 年之前
父節點
當前提交
202f0f2f1b
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs

+ 2 - 2
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