You are not logged in.
Pages: 1
mORMot2, Commit 7777, Delphi 12.1, 32Bit
Access violation for these combinations in function ObjArrayDelete().
...ObjArrayHelper.Delete(aIndex: Integer): Boolean;
var
Count: Integer;
begin
Count := Length(Self);
if (Count > 0)
and (aIndex >= 0)
and (aIndex < Count) then
begin
// Ok
ObjArrayDelete(Self, aIndex);
// Ok
ObjArrayDelete(Self, Self[aIndex]);
// raised exception class EAccessViolation with message 'Access violation at address 00FBCB6E. Read of address 70505408'.
ObjArrayDelete(Self, Count, Self[aIndex]);
// raised exception class EAccessViolation with message 'Access violation at address 00A2CB6E. Read of address 70505408'.
ObjArrayDelete(Self, aIndex, False, @Count);
With best regards
Thomas
Last edited by tbo (2024-07-10 09:25:32)
Offline
Please try
https://github.com/synopse/mORMot2/commit/b6aeac2e
Note that
1) If you use an external "Count: integer" then you SHOULD keep this as the actual count for the whole process, otherwise it is clearly wrong and would lead to GPF.
2) All ObjArrayDelete() do check aIndex against the length() so you are not required to check it before calling it.
Offline
Pages: 1