Browse Source

* Fix bug ID #32136, object not freed when replaced by another

git-svn-id: trunk@36724 -
michael 8 years ago
parent
commit
be39ca0c85
1 changed files with 3 additions and 2 deletions
  1. 3 2
      packages/rtl-generics/src/generics.collections.pas

+ 3 - 2
packages/rtl-generics/src/generics.collections.pas

@@ -699,9 +699,10 @@ end;
 procedure TList<T>.SetItem(AIndex: SizeInt; const AValue: T);
 begin
   if (AIndex < 0) or (AIndex >= Count) then
-    raise EArgumentOutOfRangeException.CreateRes(@SArgumentOutOfRange);
-
+    raise EArgumentOutOfRangeException.CreateRes(@SArgumentOutOfRange);   
+  Notify(FItems[AIndex], cnRemoved);
   FItems[AIndex] := AValue;
+  Notify(AValue, cnAdded);
 end;
 
 function TList<T>.GetEnumerator: TEnumerator;