LCL, fix AV while doing dbgrid.selectedRows.delete (and memleak under 2.6.4), issue #26913

git-svn-id: trunk@46637 -
This commit is contained in:
jesus 2014-10-22 01:05:09 +00:00
parent 30ba201a13
commit 9d659a9b1f

View File

@ -4235,13 +4235,15 @@ begin
{$ifdef dbgDBGrid} {$ifdef dbgDBGrid}
DebugLn('%s.Delete', [ClassName]); DebugLn('%s.Delete', [ClassName]);
{$endif} {$endif}
for i := 0 to FList.Count - 1 do begin for i := FList.Count-1 downto 0 do begin
FDataset.GotoBookmark(Items[i]); FDataset.GotoBookmark(Items[i]);
FDataset.Delete;
{$ifndef noautomatedbookmark} {$ifndef noautomatedbookmark}
Bookmark := FList[i]; Bookmark := FList[i];
SetLength(TBookmark(Bookmark),0); // decrease reference count SetLength(TBookmark(Bookmark),0); // decrease reference count
{$else}
FDataset.FreeBookmark(Items[i]);
{$endif noautomatedbookmark} {$endif noautomatedbookmark}
FDataset.Delete;
FList.Delete(i); FList.Delete(i);
end; end;
end; end;