Skip to content

Fix #2569: File list not updated after deleting files with GPS pane open - #2641

Closed
alfonx wants to merge 1 commit into
BestImageViewer:masterfrom
alfonx:fix/2569-gps-skip-deleted
Closed

alfonx wants to merge 1 commit into
BestImageViewer:masterfrom
alfonx:fix/2569-gps-skip-deleted

Conversation

@alfonx

@alfonx alfonx commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #2569 (and very likely the multi-selection case described by @przepompownia in #2534).

First of all: thank you for Geeqie — I use it every day and love it! And many thanks to @przepompownia for the minimal config and the hint that it needs two or more selected files; that made it reproducible.

What happens

With the GPS map pane in the sidebar and 2+ files selected, deleting them leaves them in the file list and one CPU core runs at 100%.

Backtrace of the loop (reproduced on master b427235, GTK 4.20 / libshumate 1.5):

  1. bar_pane_gps_update() creates the markers for a multi-selection in an idle callback (bar_pane_gps_create_markers_cb, G_PRIORITY_DEFAULT_IDLE).
  2. The deleted files are still in the layout selection, because the file list has not been refreshed yet.
  3. bar_pane_gps_add_file_marker() → metadata_read_GPS_coord() → exif_read_fd() → file_cache_get() → file_data_check_changed_files(), which sends NOTIFY_REREAD for the missing file.
  4. bar_pane_gps_notify_cb() finds that file in selection_list and calls bar_pane_gps_update() again, which re-queues the idle marker creation → back to 1.
  5. The file list refresh (vf_refresh_idle, G_PRIORITY_DEFAULT_IDLE + 50) never gets to run, so the deleted files stay in the list.

The fix

Keep it small and local to the GPS pane: files that no longer exist are dropped from the pane's selection_list, so their notifications are ignored and the loop cannot start. Once the file list refresh runs, the pane updates through the normal selection-change path.

Tested in a container (Fedora 43, Xvfb): multi-selection delete and single delete both update the list and advance the selection, no CPU spin.

Possible follow-ups (not in this PR, happy to hear your opinion)

  • file_data_check_changed_files() reports a missing file as changed (and sends NOTIFY_REREAD) on every call, not just once. Other consumers could run into similar ping-pong.
  • exif_read_fd() puts an entry into the exif cache even when exif_read() failed, so the next read of a deleted file is a cache hit that triggers the check again.
  • vf_notify_cb() returns early while refresh_idle_id is set, so the priority bump in vf_refresh_idle() is never reached when the refresh is starved.

I deliberately did not touch these, as they change behaviour in central code.

🤖 Generated with Claude Code

…with GPS pane open

With two or more files selected, bar_pane_gps_update() creates the map
markers in an idle callback. Deleted files remain in the layout selection
until the file list is refreshed. Reading their GPS metadata goes through
the exif cache and file_data_check_changed_files(), which sends
NOTIFY_REREAD for the missing file. bar_pane_gps_notify_cb() then calls
bar_pane_gps_update() again, which re-queues the idle marker creation.

This loop runs at G_PRIORITY_DEFAULT_IDLE and starves the file list
refresh (G_PRIORITY_DEFAULT_IDLE + 50): the deleted files stay in the
list and one CPU core runs at 100%.

Drop files that no longer exist from the pane's selection list, so their
notifications are ignored and the loop cannot start.
@przepompownia

Copy link
Copy Markdown
Contributor

@alfonx thanks for investigation: your result of digging with LLM seems to be more accurate than the effect of (in particular) wasting water suggested to me earlier (quick returns in FileData::file_data_check_changed_files()). It works on my safe repro environment.

@caclark

caclark commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

Implemented in commit 1492d3e

@caclark caclark closed this Sep 28, 2026
@przepompownia

Copy link
Copy Markdown
Contributor

Thank you @caclark

This bug was very annoying, especially when I was working in full-screen mode. Even that potentially stupid workaround suggested by the LLM allowed me to work smoothly (and without any noticeable effect) in the meantime.

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.

Deleting a file does not update the file list while the GPS pane has markers enabled

3 participants