Commit 2c540ee8 authored by Max Kellermann's avatar Max Kellermann

playlist: safely search the playlist for deleted song

When a song file is deleted during database update, all pointers to it must be removed from the playlist. The "for" loop in deleteASongFromPlaylist() did not deal with multiple copies of the deleted song properly, and left instances of the (to-be-invalidated) pointer in. Fix this by reversing the loop.
parent 2af1742f
...@@ -15,6 +15,13 @@ ver 0.15 - (200?/??/??) ...@@ -15,6 +15,13 @@ ver 0.15 - (200?/??/??)
* fix cross-fading bug: it used to play some chunks of the new song twice * fix cross-fading bug: it used to play some chunks of the new song twice
* --create-db starts the MPD daemon instead of exiting * --create-db starts the MPD daemon instead of exiting
* input_curl: honour http_proxy_* config directives * input_curl: honour http_proxy_* config directives
* playlist
- fix assertion failure during playlist load
- implement Fisher-Yates shuffle properly
- safely search the playlist for deleted song
* use custom PRNG for volume dithering (speedup)
* detect libid3tag without pkg-config
ver 0.14 (2008/12/25) ver 0.14 (2008/12/25)
* audio outputs: * audio outputs:
......
...@@ -764,7 +764,7 @@ deleteASongFromPlaylist(const struct song *song) ...@@ -764,7 +764,7 @@ deleteASongFromPlaylist(const struct song *song)
if (NULL == playlist.songs) if (NULL == playlist.songs)
return; return;
for (unsigned i = 0; i < playlist.length; i++) for (int i = playlist.length - 1; i >= 0; --i)
if (song == playlist.songs[i]) if (song == playlist.songs[i])
deleteFromPlaylist(i); deleteFromPlaylist(i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment