#1 2018-07-25 19:12:33

PBa
Member
From: Austria
Registered: 2017-01-04
Posts: 18

Bug in newly added function ObjArrayAppend (SynCommons V 1.18.4686)

Dear ab,

IMHO there is a bug in the newly intoduced function

function ObjArrayAppend(var aDestObjArray, aSourceObjArray): integer;
var n: integer;
    s: TObjectDynArray absolute aSourceObjArray;
    d: TObjectDynArray absolute aDestObjArray;
begin
  result := length(d);
  n := length(s);
  SetLength(d,result+n);
  MoveFast(s[0],d[result],n*SizeOf(pointer));
  //d := nil; // d[] will be owned by s[]
  s := nil; // s[] will be owned by d[]    <== change suggested by PBa
  inc(result,n);
end;

as described in line 6779:
// - aSourceObjArray[] items will be owned by aDestObjArray[], therefore
// aSourceObjArray is set to nil

Thanks a lot!
Best regards,
Paul

Offline

#2 2018-07-25 19:32:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Bug in newly added function ObjArrayAppend (SynCommons V 1.18.4686)

Offline

Board footer

Powered by FluxBB