core/playlists/library: Use library tag path when allocating playlists

This isn't as important for established playlists, but this string could
quickly become an invalid pointer for new playlists that are added.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-09-01 11:54:28 -04:00
parent 00c4c8a418
commit 76d8b00ecc
2 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,5 @@
6.4.19:
- Fix memory corruption when adding new library playlists
- Use Enter key to accept new library paths
- Remove deleted tracks from artist playlists
- File chooser selects user's music directory

View File

@ -16,11 +16,11 @@ static bool __lib_pl_scan_dir(void *);
static struct queue_ops *lib_ops = NULL;
static struct playlist *__lib_pl_alloc(const gchar *path)
static struct playlist *__lib_pl_alloc(struct library *library)
{
struct playlist *playlist = g_malloc(sizeof(struct playlist));
playlist->pl_name = path;
playlist->pl_name = library->li_path;
playlist->pl_type = PL_LIBRARY;
playlist_generic_init(playlist, Q_REPEAT, lib_ops);
@ -153,7 +153,7 @@ static bool pl_library_new(const gchar *name)
return false;
library = library_find(name);
library->li_playlist = __lib_pl_alloc(name);
library->li_playlist = __lib_pl_alloc(library);
__lib_pl_scan_dir_idle(library, name);
return true;
@ -223,7 +223,7 @@ static bool __lib_pl_init(void *data)
struct playlist *playlist;
db_for_each(dbe, next, library_db_get()) {
playlist = __lib_pl_alloc(LIBRARY(dbe)->li_path);
playlist = __lib_pl_alloc(LIBRARY(dbe));
LIBRARY(dbe)->li_playlist = playlist;
idle_schedule(IDLE_SYNC, __lib_pl_load, playlist);