[lazarus] Duplicate condition in HandleNeeded

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Dec 1 16:46:06 EST 2002


On Sun, 01 Dec 2002 15:50:08 +0100
Martin Smat <martin.smat at tiscali.cz> wrote:

> Hi,
> in procedure TWinControl.HandleNeeded is this part of code:
> ...
> if not HandleAllocated then
>   begin
>     if Parent = Self
>     then begin
>       Assert( ... );
>     end
>     else begin
>       if (Parent <> nil) then
>         Parent.HandleNeeded;
          ^^^^^^^^^^^^^^^^^^^^
This line can create a handle. 


>     end;
>     if not HandleAllocated then  //********

This line is needed to end the recursion.


>       CreateHandle;
>   end;
> ...
> Is the condition marked with asterisks really needed? IMO it si useless 
> because the same condition is 10 lines above and here it returns always 
> true. Can it be deleted or did I anything overlook?

yes, no, yes.


Mattias






More information about the Lazarus mailing list