Przeglądaj źródła

* fixed bug in TFPSList.SetCount. Deref was not called when shrinking the list.

git-svn-id: trunk@13851 -
ivost 16 lat temu
rodzic
commit
f18a2ab69c
1 zmienionych plików z 5 dodań i 8 usunięć
  1. 5 8
      rtl/objpas/fgl.pp

+ 5 - 8
rtl/objpas/fgl.pp

@@ -357,15 +357,12 @@ procedure TFPSList.SetCount(NewCount: Integer);
 begin
   if (NewCount < 0) or (NewCount > MaxListSize) then
     Error(SListCountError, NewCount);
+  if NewCount > FCapacity then
+    SetCapacity(NewCount);
   if NewCount > FCount then
-  begin
-    if NewCount > FCapacity then
-      SetCapacity(NewCount);
-    if NewCount > FCount then
-      FillByte(InternalItems[FCount]^, (NewCount-FCount) * FItemSize, 0)
-    else if NewCount < FCount then
-      Deref(NewCount, FCount-1);
-  end;
+    FillByte(InternalItems[FCount]^, (NewCount-FCount) * FItemSize, 0)
+  else if NewCount < FCount then
+    Deref(NewCount, FCount-1);
   FCount := NewCount;
 end;