mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-16 11:42:12 +08:00
Avoid accessing GetParentForm if it's already destroyed - hopefully fixes issue #1462
This commit is contained in:
@ -5513,6 +5513,7 @@ procedure TMainForm.SaveListSetup( List: TVirtualStringTree );
|
|||||||
var
|
var
|
||||||
i : Byte;
|
i : Byte;
|
||||||
ColWidths, ColsVisible, ColPos, Regname: String;
|
ColWidths, ColsVisible, ColPos, Regname: String;
|
||||||
|
OwnerForm: TCustomForm;
|
||||||
begin
|
begin
|
||||||
ColWidths := '';
|
ColWidths := '';
|
||||||
ColsVisible := '';
|
ColsVisible := '';
|
||||||
@ -5540,8 +5541,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
OpenRegistry;
|
OpenRegistry;
|
||||||
Regname := List.Name;
|
Regname := List.Name;
|
||||||
if GetParentForm(List) <> Self then
|
OwnerForm := GetParentForm(List);
|
||||||
Regname := GetParentForm(List).Name + '.' + Regname;
|
if OwnerForm <> Self then begin
|
||||||
|
// On a windows shutdown, GetParentForm() seems sporadically unable to find the owner form
|
||||||
|
// In that case we would cause an exception when accessing it. Emergency break in that case.
|
||||||
|
// See issue #1462
|
||||||
|
if not Assigned(OwnerForm) then
|
||||||
|
Exit;
|
||||||
|
Regname := OwnerForm.Name + '.' + Regname;
|
||||||
|
end;
|
||||||
MainReg.WriteString( REGPREFIX_COLWIDTHS + Regname, ColWidths );
|
MainReg.WriteString( REGPREFIX_COLWIDTHS + Regname, ColWidths );
|
||||||
MainReg.WriteString( REGPREFIX_COLSVISIBLE + Regname, ColsVisible );
|
MainReg.WriteString( REGPREFIX_COLSVISIBLE + Regname, ColsVisible );
|
||||||
MainReg.WriteString( REGPREFIX_COLPOS + Regname, ColPos );
|
MainReg.WriteString( REGPREFIX_COLPOS + Regname, ColPos );
|
||||||
|
Reference in New Issue
Block a user