Browse Source

* ensure that the elements field of ffi_type is initialized correctly so that the trick with the dynamic array works correctly

git-svn-id: trunk@39892 -
svenbarth 6 years ago
parent
commit
91899c7bb1
1 changed files with 2 additions and 0 deletions
  1. 2 0
      packages/libffi/src/ffi.manager.pp

+ 2 - 0
packages/libffi/src/ffi.manager.pp

@@ -70,6 +70,7 @@ begin
   New(Result);
   FillChar(Result^, SizeOf(Result), 0);
   Result^._type := _FFI_TYPE_STRUCT;
+  Result^.elements := Nil;
   curoffset := 0;
   curindex := 0;
   field := PManagedField(PByte(@td^.TotalFieldCount) + SizeOf(td^.TotalFieldCount));
@@ -144,6 +145,7 @@ begin
     Exit(Nil);
   New(Result);
   Result^._type := _FFI_TYPE_STRUCT;
+  Result^.elements := Nil;
   curindex := 0;
   SetLength(elements, aSize);
   while aSize >= SizeOf(QWord) do begin