core/playlists/artist: Add pl_artist_delete_track()
Library playlists call this when deleting tracks, otherwise we could end up dereferencing invalid pointers the next time we use the artist playlist. Fixes #81: Remove deleted tracks from artist playlists Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
4e5ae5e57c
commit
20f10c163d
|
@ -1,3 +1,6 @@
|
|||
6.4.19:
|
||||
- Remove deleted tracks from artist playlists
|
||||
|
||||
6.4.19-rc:
|
||||
- Allow filtering specific fields
|
||||
- Replace filtering with a token matching system
|
||||
|
|
|
@ -139,5 +139,14 @@ void pl_artist_new_track(struct track *track)
|
|||
artist->ar_playlist = playlist;
|
||||
}
|
||||
|
||||
queue_add(&playlist->pl_queue, track);
|
||||
playlist_generic_add_track(playlist, track);
|
||||
}
|
||||
|
||||
void pl_artist_delete_track(struct track *track)
|
||||
{
|
||||
struct artist *artist = track->tr_artist;
|
||||
struct playlist *playlist = (struct playlist *)artist->ar_playlist;
|
||||
|
||||
if (playlist)
|
||||
playlist_generic_remove_track(playlist, track);
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ static bool __lib_pl_update(void *data)
|
|||
path = track_path(TRACK(dbe));
|
||||
if (g_access(path, F_OK) < 0) {
|
||||
pl_system_delete_track(TRACK(dbe));
|
||||
pl_artist_delete_track(TRACK(dbe));
|
||||
queue_remove_all(&playlist->pl_queue, TRACK(dbe));
|
||||
track_remove(TRACK(dbe));
|
||||
}
|
||||
|
|
|
@ -18,4 +18,7 @@ void pl_artist_deinit();
|
|||
/* Called to tell system playlists about a new track. */
|
||||
void pl_artist_new_track(struct track *);
|
||||
|
||||
/* Called to tell artist playlists that a track is getting deleted. */
|
||||
void pl_artist_delete_track(struct track *);
|
||||
|
||||
#endif /* OCARINA_CORE_PLAYLISTS_ARTIST_H */
|
||||
|
|
Loading…
Reference in New Issue