* fixed refcounting problem. When copy an item over an existing one, the existing one was not dereferenced

* removed some old (useless) commented code

git-svn-id: trunk@16424 -
This commit is contained in:
ivost 2010-11-24 23:08:12 +00:00
parent d30952b408
commit e770bc597f

View File

@ -780,15 +780,10 @@ end;
procedure TFPGObjectList.CopyItem(Src, Dest: Pointer);
begin
T(Dest^) := T(Src^);
{if TObject(Dest^) is TInterfacedObject then
T(Dest^)._AddRef;}
end;
procedure TFPGObjectList.Deref(Item: Pointer);
begin
{if TObject(Item^) is TInterfacedObject then
T(Item^)._Release
else}
if FFreeObjects then
T(Item^).Free;
end;
@ -879,6 +874,8 @@ end;
procedure TFPGInterfacedObjectList.CopyItem(Src, Dest: Pointer);
begin
if Assigned(Pointer(Dest^)) then
T(Dest^)._Release;
T(Dest^) := T(Src^);
if Assigned(Pointer(Dest^)) then
T(Dest^)._AddRef;