Refresh library views when a trashed track is not in the play queue#148
Open
NitishNaineni wants to merge 1 commit into
Open
Refresh library views when a trashed track is not in the play queue#148NitishNaineni wants to merge 1 commit into
NitishNaineni wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.