mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 10:02:10 +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
|
||||
i : Byte;
|
||||
ColWidths, ColsVisible, ColPos, Regname: String;
|
||||
OwnerForm: TCustomForm;
|
||||
begin
|
||||
ColWidths := '';
|
||||
ColsVisible := '';
|
||||
@ -5540,8 +5541,15 @@ begin
|
||||
end;
|
||||
OpenRegistry;
|
||||
Regname := List.Name;
|
||||
if GetParentForm(List) <> Self then
|
||||
Regname := GetParentForm(List).Name + '.' + Regname;
|
||||
OwnerForm := GetParentForm(List);
|
||||
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_COLSVISIBLE + Regname, ColsVisible );
|
||||
MainReg.WriteString( REGPREFIX_COLPOS + Regname, ColPos );
|
||||
|
Reference in New Issue
Block a user