aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-10-11 23:59:45 -0700
committerEric Wong <normalperson@yhbt.net>2008-10-12 05:27:33 -0700
commitf58827951ff79539125dcb4b1bd08e549e347a62 (patch)
tree4bb6932a400e38597ed98ceee9587e1f28855037
parentae8e81043dcf2169f4fb137a74df9926ed248f38 (diff)
downloadmpd-f58827951ff79539125dcb4b1bd08e549e347a62.tar.gz
mpd-f58827951ff79539125dcb4b1bd08e549e347a62.tar.xz
mpd-f58827951ff79539125dcb4b1bd08e549e347a62.zip
update: serialize song_free in main thread
It's actually possible to have a traverser accessing a song while we're freeing it in the main thread, as the songvec iterators don't lock the individual elements.
-rw-r--r--src/update.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/update.c b/src/update.c
index 99a58a06e..c3e5b9a7c 100644
--- a/src/update.c
+++ b/src/update.c
@@ -74,9 +74,6 @@ static void delete_song(struct directory *dir, struct mpd_song *del)
wakeup_main_task();
do { cond_wait(&delete_cond); } while (delete);
cond_leave(&delete_cond);
-
- /* finally, all possible references gone, free it */
- song_free(del);
}
static int delete_each_song(struct mpd_song *song, mpd_unused void *data)
@@ -423,6 +420,7 @@ void reap_update_task(void)
char tmp[MPD_PATH_MAX];
LOG("removing: %s\n", song_get_url(delete, tmp));
deleteASongFromPlaylist(delete);
+ song_free(delete);
delete = NULL;
cond_signal(&delete_cond);
}