mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 18:12:05 +08:00
Remove auto-stored section of closed tab only if section belongs to the current app instance. See https://www.heidisql.com/forum.php?t=36922
This commit is contained in:
@ -2296,6 +2296,7 @@ var
|
|||||||
Sections: TStringList;
|
Sections: TStringList;
|
||||||
TabsIni: TIniFile;
|
TabsIni: TIniFile;
|
||||||
SectionTabExists: Boolean;
|
SectionTabExists: Boolean;
|
||||||
|
pid: Cardinal;
|
||||||
begin
|
begin
|
||||||
// Store query tab unsaved contents and setup, in tabs.ini
|
// Store query tab unsaved contents and setup, in tabs.ini
|
||||||
|
|
||||||
@ -2323,11 +2324,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Tabs with deleted files don't get restored anyway. But closed tabs with physically existing
|
// Tabs with deleted backup files don't get restored anyway. But a section from a closed user loaded tab
|
||||||
// files still need to be erased
|
// still needs to be erased. Otherwise it's loaded on next app start again.
|
||||||
Sections := TStringList.Create;
|
Sections := TStringList.Create;
|
||||||
TabsIni.ReadSections(Sections);
|
TabsIni.ReadSections(Sections);
|
||||||
for Section in Sections do begin
|
for Section in Sections do begin
|
||||||
|
// Loop through local tabs
|
||||||
SectionTabExists := False;
|
SectionTabExists := False;
|
||||||
for Tab in QueryTabs do begin
|
for Tab in QueryTabs do begin
|
||||||
if Tab.Uid = Section then begin
|
if Tab.Uid = Section then begin
|
||||||
@ -2335,8 +2337,9 @@ begin
|
|||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
// Delete tab section if no tab was closed
|
// Delete tab section if tab was closed and section belongs to this app instance
|
||||||
if not SectionTabExists then begin
|
pid := Cardinal(TabsIni.ReadInteger(Section, 'pid', 0));
|
||||||
|
if (not SectionTabExists) and (pid = GetCurrentProcessId) then begin
|
||||||
TabsIni.EraseSection(Section);
|
TabsIni.EraseSection(Section);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user