Browse Source

Patch from Joao Morais to fix memory leak with owner lists

git-svn-id: trunk@11045 -
michael 17 years ago
parent
commit
a2c012e228
1 changed files with 5 additions and 1 deletions
  1. 5 1
      rtl/objpas/classes/lists.inc

+ 5 - 1
rtl/objpas/classes/lists.inc

@@ -544,7 +544,11 @@ end;
 
 
 procedure TList.SetCount(NewCount: Integer);
 procedure TList.SetCount(NewCount: Integer);
 begin
 begin
-  FList.SetCount(NewCount);
+  if NewCount < FList.Count then
+    while FList.Count > NewCount do
+      Delete(FList.Count - 1)
+  else
+    FList.SetCount(NewCount);
 end;
 end;
 
 
 constructor TList.Create;
 constructor TList.Create;