Skip to content

Fix crash deleting the last image in a multi-file set - #2

Merged
frathe merged 1 commit into
mainfrom
bugfix/viewer-delete-last-image-crash
Aug 16, 2026
Merged

Fix crash deleting the last image in a multi-file set#2
frathe merged 1 commit into
mainfrom
bugfix/viewer-delete-last-image-crash

Conversation

@frathe

@frathe frathe commented Aug 16, 2026

Copy link
Copy Markdown
Owner

RemoveFile trimmed v.files but never adjusted v.index, so deleting while viewing the last image left v.index pointing past the shrunk slice - the next CurrentFile() call then indexed out of range and crashed the app. Clamp v.index in RemoveFile when it now points past the end.

What does this change do, and why?

Fixes a crash when the last image in a list that is currently displayed gets deleted.
Added regression test.

How was this tested?

existing test suit + flame test on Linux and MacOS

Checklist

  • gofmt -l . is clean, go vet ./... and go test -race ./... pass
  • User-visible strings go through lang.L, with the key added to every
    bundle in translations/
  • internal/ui/help/manual.md and manual_de.md updated, if this
    changes documented behavior
  • ARCHITECTURE.md updated, if this changes the package structure
  • No new TODO/FIXME comments — open items go in todos.md instead

RemoveFile trimmed v.files but never adjusted v.index, so deleting
while viewing the last image left v.index pointing past the shrunk
slice - the next CurrentFile() call then indexed out of range and
crashed the app. Clamp v.index in RemoveFile when it now points past
the end.
@frathe
frathe merged commit bcf5fdb into main Aug 16, 2026
6 checks passed
@frathe
frathe deleted the bugfix/viewer-delete-last-image-crash branch August 16, 2026 20:24
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.

1 participant