aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-19 05:07:31 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-19 05:07:31 +0000
commit33faf9812ccea04e7787d04eadf503ce1febc6b7 (patch)
tree2e3463d734d8172a0802543918d5093f87f10d9b /src/playlist.c
parentef8209e12962a28f392372a6f6048e016cea273e (diff)
downloadmpd-33faf9812ccea04e7787d04eadf503ce1febc6b7.tar.gz
mpd-33faf9812ccea04e7787d04eadf503ce1febc6b7.tar.xz
mpd-33faf9812ccea04e7787d04eadf503ce1febc6b7.zip
fix a nasty bug when deleting a stream from the playlist
git-svn-id: https://svn.musicpd.org/mpd/trunk@1082 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/playlist.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/playlist.c b/src/playlist.c
index ce7ac77df..60b40f4f9 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -138,6 +138,12 @@ void initPlaylist() {
}
void finishPlaylist() {
+ int i;
+ for(i=0;i<playlist.length;i++) {
+ if(playlist.songs[i]->type == SONG_TYPE_URL) {
+ /*freeJustSong(playlist.songs[i]);*/
+ }
+ }
free(playlist.songs);
playlist.songs = NULL;
free(playlist.order);
@@ -151,7 +157,7 @@ int clearPlaylist(FILE * fp) {
for(i=0;i<playlist.length;i++) {
if(playlist.songs[i]->type == SONG_TYPE_URL) {
- free(playlist.songs[i]);
+ /*freeJustSong(playlist.songs[i]);*/
}
playlist.songs[i] = NULL;
}
@@ -584,6 +590,10 @@ int deleteFromPlaylist(FILE * fp, int song) {
}
}
+ if(playlist.songs[song]->type == SONG_TYPE_URL) {
+ freeJustSong(playlist.songs[song]);
+ }
+
/* delete song from songs array */
for(i=song;i<playlist.length-1;i++) {
playlist.songs[i] = playlist.songs[i+1];
@@ -600,9 +610,6 @@ int deleteFromPlaylist(FILE * fp, int song) {
if(playlist.order[i]>song) playlist.order[i]--;
}
/* now take care of other misc stuff */
- if(playlist.songs[playlist.length-1]->type == SONG_TYPE_URL) {
- freeJustSong(playlist.songs[playlist.length-1]);
- }
playlist.songs[playlist.length-1] = NULL;
playlist.length--;