LCL: TWinControl.WndProc LM_SETFOCUS: check csDestroying for form

git-svn-id: trunk@24421 -
This commit is contained in:
mattias 2010-04-04 23:52:22 +00:00
parent 408eb18c12
commit 04c7c63cf7
2 changed files with 7 additions and 4 deletions

View File

@ -1970,6 +1970,8 @@ var
begin
Result := False;
if (Control <> nil) and (csDestroying in Control.ComponentState) then Exit;
if (csDestroying in ComponentState) or (csDestroyingHandle in ControlState) then
exit;
if (Parent <> nil) then
begin

View File

@ -5074,10 +5074,11 @@ begin
{$IFDEF VerboseFocus}
DebugLn('TWinControl.WndProc LM_SetFocus ',DbgSName(Self));
{$ENDIF}
if (not (csDestroyingHandle in ControlState))
and (not (csDestroying in ComponentState)) then
begin
Form := GetParentForm(Self);
Form := GetParentForm(Self);
if (Form<>nil)
and (not (csDestroyingHandle in ControlState))
and (not (csDestroying in ComponentState))
then begin
if (Form <> nil) and not Form.SetFocusedControl(Self) then Exit;
Message.Result := 0;
end;