Hello.
In TWinControl.Destroy there is code:
while n > 0 do
begin
Control := Controls[n - 1];
Remove(Control); <--
...
Control.Parent := nil; <--
n := ControlCount;
end;In Remove() which is non-virtual:
procedure TWinControl.Remove(AControl : TControl);
begin
if AControl nil then
begin
...
AControl.FParent := nil;
...
end;
end;
So, first there is AControl.FParent := nil, then there is
Control.Parent := nil. There is one too many.Also, the first assignment is directly to variable bypassing virtual SetParent. The other uses property which calls SetParent but it doesn't do anything because Parent is already =nil.
Is it correct that Control.Parent can be removed? And which should be the correct version of assignment: using FParent or Parent?
cobines
