aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/directory.c')
-rw-r--r--src/directory.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/directory.c b/src/directory.c
index fa0856dc5..e7210816f 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -68,6 +68,8 @@ static pthread_t update_thr;
static int directory_updateJobId;
+static struct songvec reap_songs;
+
static DirectoryList *newDirectoryList(void);
static int addToDirectory(Directory * directory,
@@ -125,6 +127,13 @@ void reap_update_task(void)
{
if (progress != UPDATE_PROGRESS_DONE)
return;
+ if (reap_songs.base) {
+ int i;
+ for (i = reap_songs.nr; --i >= 0; )
+ freeSong(reap_songs.base[i]);
+ reap_songs.nr = 0;
+ reap_songs.base = NULL;
+ }
pthread_join(update_thr, NULL);
progress = UPDATE_PROGRESS_IDLE;
}
@@ -241,7 +250,7 @@ static void removeSongFromDirectory(Directory * directory, const char *shortname
char path_max_tmp[MPD_PATH_MAX]; /* wasteful */
LOG("removing: %s\n", get_song_url(path_max_tmp, song));
songvec_delete(&directory->songs, song);
- freeSong(song);
+ songvec_add(&reap_songs, song);
}
}