playlist: clear pc.errored_song on delete

When a (remote) song is deleted from the playlist, there may still be
a reference to it in pc.errored_song.  Clear this reference.
This commit is contained in:
Max Kellermann
2008-12-17 16:45:49 +01:00
parent 25c04a97d3
commit 13192546a8
3 changed files with 23 additions and 2 deletions

View File

@@ -200,8 +200,10 @@ void clearPlaylist(void)
stopPlaylist();
for (unsigned i = 0; i < playlist.length; i++) {
if (!song_in_database(playlist.songs[i]))
if (!song_in_database(playlist.songs[i])) {
pc_song_deleted(playlist.songs[i]);
song_free(playlist.songs[i]);
}
playlist.idToPosition[playlist.positionToId[i]] = -1;
playlist.songs[i] = NULL;
@@ -670,8 +672,10 @@ enum playlist_result deleteFromPlaylist(unsigned song)
|| playlist.order[playlist.current] == song))
clearPlayerQueue();
if (!song_in_database(playlist.songs[song]))
if (!song_in_database(playlist.songs[song])) {
pc_song_deleted(playlist.songs[song]);
song_free(playlist.songs[song]);
}
playlist.idToPosition[playlist.positionToId[song]] = -1;
@@ -738,6 +742,8 @@ deleteASongFromPlaylist(const struct song *song)
for (unsigned i = 0; i < playlist.length; i++)
if (song == playlist.songs[i])
deleteFromPlaylist(i);
pc_song_deleted(song);
}
void stopPlaylist(void)