You are not logged in.
Hi Arnaud,
I think there's an issue with TPropInfo.SameValues.
I have a simple DTO class inheriting from TSynPersistent. This DTO class has a TSomethingObjArray published property. When calling TPropInfo.SameValue the function crashes with an access violation for the ObjectEquals method call concerning the ObjArray.
function TPropInfo.SameValue(Source: TObject; DestInfo: PPropInfo; Dest: TObject): boolean;
.
.
.
tkDynArray: begin
GetDynArray(Source,daS);
DestInfo^.GetDynArray(Dest,daD);
if daS.Count=daD.Count then
if DynArrayIsObjArray and
((@self=DestInfo) or DestInfo^.DynArrayIsObjArray) then begin
for i := 0 to daS.Count-1 do
if not ObjectEquals(PObjectArray(daS.Value)[i],PObjectArray(daD.Value)[i]) then // ->> ACCESS VIOLATION
.
.
.
It looks like if PObjectArray(daS.Value) cast is invalid.
I could fix that issue by changing:
if not ObjectEquals(PObjectArray(daS.Value)[i],PObjectArray(daD.Value)[i]) then
to:
if not ObjectEquals(TObject(daS.ElemPtr(i)^),TObject(daD.ElemPtr(i)^)) then
Could you please have a look at that issue?
Thanks, oz.
Last edited by oz (2017-08-25 13:07:26)
Offline
Please check https://synopse.info/fossil/info/63e26718bb
I've also discovered a potential problem with double and currency values in the same method - should be fixed now too!
Offline
Sorry for replying late, the issue is fixed indeed. Thank you!
Offline