mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 05:51:26 +02:00
* fixed bug in TFPSList.SetCount. Deref was not called when shrinking the list.
git-svn-id: trunk@13851 -
This commit is contained in:
parent
709d1ccc0c
commit
f18a2ab69c
@ -357,15 +357,12 @@ procedure TFPSList.SetCount(NewCount: Integer);
|
|||||||
begin
|
begin
|
||||||
if (NewCount < 0) or (NewCount > MaxListSize) then
|
if (NewCount < 0) or (NewCount > MaxListSize) then
|
||||||
Error(SListCountError, NewCount);
|
Error(SListCountError, NewCount);
|
||||||
|
if NewCount > FCapacity then
|
||||||
|
SetCapacity(NewCount);
|
||||||
if NewCount > FCount then
|
if NewCount > FCount then
|
||||||
begin
|
FillByte(InternalItems[FCount]^, (NewCount-FCount) * FItemSize, 0)
|
||||||
if NewCount > FCapacity then
|
else if NewCount < FCount then
|
||||||
SetCapacity(NewCount);
|
Deref(NewCount, FCount-1);
|
||||||
if NewCount > FCount then
|
|
||||||
FillByte(InternalItems[FCount]^, (NewCount-FCount) * FItemSize, 0)
|
|
||||||
else if NewCount < FCount then
|
|
||||||
Deref(NewCount, FCount-1);
|
|
||||||
end;
|
|
||||||
FCount := NewCount;
|
FCount := NewCount;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user