On Mon, 23 May 2011 22:07:58 +0200 cobines <[email protected]> wrote:
> Hello. > > In TWinControl.Destroy there is code: > > while n > 0 do > begin > Control := Controls[n - 1]; > Remove(Control); <-- > ... > Control.Parent := nil; <-- That one was not needed any more. I removed it. > 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? FParent is correct. Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
