Browse Source

* Remove using reverse search, speed up free

git-svn-id: trunk@19280 -
michael 14 năm trước cách đây
mục cha
commit
d766e671a9
1 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 8 2
      rtl/objpas/classes/collect.inc

+ 8 - 2
rtl/objpas/classes/collect.inc

@@ -215,9 +215,15 @@ end;
 
 
 procedure TCollection.RemoveItem(Item: TCollectionItem);
+
+Var
+  I : Integer;
+
 begin
-        Notify(Item,cnExtracting);
-  FItems.Remove(Pointer(Item));
+  Notify(Item,cnExtracting);
+  I:=FItems.IndexOfItem(Item,fromEnd);
+  If (I<>-1) then
+    FItems.Delete(I);
   Item.FCollection:=Nil;
   Changed;
 end;