mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 09:26:15 +02:00
* 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:
parent
d30952b408
commit
e770bc597f
@ -780,15 +780,10 @@ end;
|
|||||||
procedure TFPGObjectList.CopyItem(Src, Dest: Pointer);
|
procedure TFPGObjectList.CopyItem(Src, Dest: Pointer);
|
||||||
begin
|
begin
|
||||||
T(Dest^) := T(Src^);
|
T(Dest^) := T(Src^);
|
||||||
{if TObject(Dest^) is TInterfacedObject then
|
|
||||||
T(Dest^)._AddRef;}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPGObjectList.Deref(Item: Pointer);
|
procedure TFPGObjectList.Deref(Item: Pointer);
|
||||||
begin
|
begin
|
||||||
{if TObject(Item^) is TInterfacedObject then
|
|
||||||
T(Item^)._Release
|
|
||||||
else}
|
|
||||||
if FFreeObjects then
|
if FFreeObjects then
|
||||||
T(Item^).Free;
|
T(Item^).Free;
|
||||||
end;
|
end;
|
||||||
@ -879,6 +874,8 @@ end;
|
|||||||
|
|
||||||
procedure TFPGInterfacedObjectList.CopyItem(Src, Dest: Pointer);
|
procedure TFPGInterfacedObjectList.CopyItem(Src, Dest: Pointer);
|
||||||
begin
|
begin
|
||||||
|
if Assigned(Pointer(Dest^)) then
|
||||||
|
T(Dest^)._Release;
|
||||||
T(Dest^) := T(Src^);
|
T(Dest^) := T(Src^);
|
||||||
if Assigned(Pointer(Dest^)) then
|
if Assigned(Pointer(Dest^)) then
|
||||||
T(Dest^)._AddRef;
|
T(Dest^)._AddRef;
|
||||||
|
Loading…
Reference in New Issue
Block a user