LCL: Prevent a crash when closing a form with an active in-place cell editor of a grid. Issue #37202.

git-svn-id: trunk@63541 -
This commit is contained in:
juha 2020-07-11 09:07:35 +00:00
parent c63e4ba86a
commit 1f0ff07dc2

View File

@ -8412,9 +8412,11 @@ var
begin begin
if not EditorLocked and (Editor<>nil) and Editor.Visible then if not EditorLocked and (Editor<>nil) and Editor.Visible then
begin begin
WasFocused := Editor.Focused; FEditorMode := False;
FEditorMode:=False;
FGridState := gsNormal; FGridState := gsNormal;
if Editor.Owner<>nil then // May be nil when the form is closing.
begin
WasFocused := Editor.Focused;
{$ifdef dbgGrid}DebugLnEnter('EditorHide [',Editor.ClassName,'] INIT FCol=',IntToStr(FCol),' FRow=',IntToStr(FRow));{$endif} {$ifdef dbgGrid}DebugLnEnter('EditorHide [',Editor.ClassName,'] INIT FCol=',IntToStr(FCol),' FRow=',IntToStr(FRow));{$endif}
LockEditor; LockEditor;
try try
@ -8426,6 +8428,7 @@ begin
end; end;
{$ifdef dbgGrid}DebugLnExit('EditorHide END');{$endif} {$ifdef dbgGrid}DebugLnExit('EditorHide END');{$endif}
end; end;
end;
end; end;
function TCustomGrid.EditorLocked: boolean; function TCustomGrid.EditorLocked: boolean;