Cocoa: fix #40581, avoid sending KillFocus messages repeatedly when closing window

This commit is contained in:
rich2014 2024-01-19 22:11:13 +08:00
parent 88d32c5c97
commit de565120e0

View File

@ -402,9 +402,11 @@ var
begin
CocoaWidgetSet.KeyWindow:= nil;
focusedCb := window.firstResponder.lclGetCallback;
if Assigned(focusedCb) then
focusedCb.ResignFirstResponder;
focusedCb:= window.firstResponder.lclGetCallback;
if Assigned(focusedCb) then begin
if not (csDestroying in TComponent(focusedCb.GetTarget).ComponentState) then
focusedCb.ResignFirstResponder;
end;
LCLSendActivateMsg(Target, WA_INACTIVE, false);
end;