Skip to content

fix: replace the last-open-files list when a window closes (#686) - #691

Merged
Hirogen merged 1 commit into
Developmentfrom
fix/last-open-files-list-never-cleared
Jul 30, 2026
Merged

fix: replace the last-open-files list when a window closes (#686)#691
Hirogen merged 1 commit into
Developmentfrom
fix/last-open-files-list-never-cleared

Conversation

@Hirogen

@Hirogen Hirogen commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes #686.

SaveLastOpenFilesList only ever appended, while the clear lived in one branch of LoadStartupFiles. Starting with command-line files, or with Open last files off, skipped that clear — so each close appended the current tabs to a stale list, which grew without bound and restored tabs closed sessions ago.

The closing window now owns the list. The first window to close replaces it; windows closing after it append, so a multi-window session is still restored as a whole rather than only the last window to close. The clear in LoadStartupFiles is removed, so a crash mid-session no longer wipes the set of files to restore.

Behaviour notes:

  • Within one long-lived process, closing several windows in sequence unions their files — same as before this change, and bounded by process lifetime instead of accumulating across restarts.
  • The clear-then-add pair is not atomic (only the clear takes _loadSaveLock), unchanged from before and only reachable if two windows close at the same instant.

Tests: replace-on-first-close, append-on-second-window, clear when only temp files are open, and load-keeps-the-list.

SaveLastOpenFilesList only ever appended, and the list was cleared in one
branch of LoadStartupFiles. Startup with command-line files, or with
"Open last files" turned off, skipped that clear, so every close appended
the current tabs to a stale list: it grew without bound and restored tabs
closed sessions ago.

The closing window now owns the list. The first window to close replaces
it, dropping entries from earlier sessions; windows closing after it
append, so a multi-window session is still restored as a whole. The clear
in LoadStartupFiles is gone, which also means a crash mid-session no
longer wipes the set of files to restore.

Tests cover the replace, the append for a second closing window, the
clear when only temp files are open, and that loading keeps the list.
@Hirogen
Hirogen merged commit 7959e62 into Development Jul 30, 2026
3 checks passed
@Hirogen
Hirogen deleted the fix/last-open-files-list-never-cleared branch July 30, 2026 11:59
@Pr0metheus2

Pr0metheus2 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

When app closes, it looks like it wipes the set of files to restore. Older version (I think from 2 days ago) does remember this.

###Before close:
image

###After close:
image

@Hirogen

Hirogen commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

Older version

interesting, should only wipe it if no files are open, probably a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LastOpenFilesList is never cleared when startup files are passed or "Open last files" is disabled

2 participants