Skip to content

Refresh library views when a trashed track is not in the play queue#148

Open
NitishNaineni wants to merge 1 commit into
neithern:masterfrom
NitishNaineni:fix-deleted-track-lingering-in-ui
Open

Refresh library views when a trashed track is not in the play queue#148
NitishNaineni wants to merge 1 commit into
neithern:masterfrom
NitishNaineni:fix-deleted-track-lingering-in-ui

Conversation

@NitishNaineni

Copy link
Copy Markdown

when you delete a track, on_music_lost takes it out of the play queue and counts on the queue's items_changed signal to refresh the album/artist/playlist views. but if the track isnt in the queue, the queue never changes, music_library_changed never fires, and the deleted row just sits there until you manually reload.

theres also a second problem. the queue can hold a different Music instance than the cache/library for the same file (the queue gets restored before the library is scanned, and a changed mtime makes the loader build a fresh instance). so remove_items_from_store, which matches by object identity, can miss the track even when it is in the queue.

fix: match queue items by uri instead of identity, and always refresh the library views after a delete whether or not the queue changed.

note: i dont write vala, so the patch was AI-assisted. i did reproduce the bug and confirm the fix works (built from source, deleted tracks that were/weren't in the queue), and reviewed the change against the GLib/GTK docs.

on_music_lost removed the lost track from the play queue and relied on
the queue's items_changed signal to refresh the album/artist/playlist
views. When the track was not in the play queue, the queue never changed,
music_library_changed was never emitted, and the deleted row stayed
visible until a manual reload.

The play queue can also hold a different Music instance than the tag
cache/library for the same file (the queue is restored before the library
is scanned, and a changed mtime makes the loader build a fresh instance),
so the identity-based remove_items_from_store could miss the track even
when it was in the queue.

Match queue items to remove by URI instead of object identity, and always
refresh the library views after a removal regardless of whether the queue
changed.
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