summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2>2008-05-23 07:11:33 +0000
committermichael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2>2008-05-23 07:11:33 +0000
commitf409cbf6cb1bb857c95ae0ad38775981e1aff4a0 (patch)
tree73b808f57f86bec0a4898f02bbf63d220004245b
parente4040630c6befc604eebc4effd6cc81df962982d (diff)
downloadfpc-f409cbf6cb1bb857c95ae0ad38775981e1aff4a0.tar.gz
Patch from Joao Morais to fix memory leak with owner lists
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@11045 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--rtl/objpas/classes/lists.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/rtl/objpas/classes/lists.inc b/rtl/objpas/classes/lists.inc
index 2ce29a48a7..acc441de90 100644
--- a/rtl/objpas/classes/lists.inc
+++ b/rtl/objpas/classes/lists.inc
@@ -544,7 +544,11 @@ end;
procedure TList.SetCount(NewCount: Integer);
begin
- FList.SetCount(NewCount);
+ if NewCount < FList.Count then
+ while FList.Count > NewCount do
+ Delete(FList.Count - 1)
+ else
+ FList.SetCount(NewCount);
end;
constructor TList.Create;