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:
parent
00c4c8a418
commit
76d8b00ecc
|
@ -1,4 +1,5 @@
|
||||||
6.4.19:
|
6.4.19:
|
||||||
|
- Fix memory corruption when adding new library playlists
|
||||||
- Use Enter key to accept new library paths
|
- Use Enter key to accept new library paths
|
||||||
- Remove deleted tracks from artist playlists
|
- Remove deleted tracks from artist playlists
|
||||||
- File chooser selects user's music directory
|
- File chooser selects user's music directory
|
||||||
|
|
|
@ -16,11 +16,11 @@ static bool __lib_pl_scan_dir(void *);
|
||||||
static struct queue_ops *lib_ops = NULL;
|
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));
|
struct playlist *playlist = g_malloc(sizeof(struct playlist));
|
||||||
|
|
||||||
playlist->pl_name = path;
|
playlist->pl_name = library->li_path;
|
||||||
playlist->pl_type = PL_LIBRARY;
|
playlist->pl_type = PL_LIBRARY;
|
||||||
playlist_generic_init(playlist, Q_REPEAT, lib_ops);
|
playlist_generic_init(playlist, Q_REPEAT, lib_ops);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ static bool pl_library_new(const gchar *name)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
library = library_find(name);
|
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);
|
__lib_pl_scan_dir_idle(library, name);
|
||||||
return true;
|
return true;
|
||||||
|
@ -223,7 +223,7 @@ static bool __lib_pl_init(void *data)
|
||||||
struct playlist *playlist;
|
struct playlist *playlist;
|
||||||
|
|
||||||
db_for_each(dbe, next, library_db_get()) {
|
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;
|
LIBRARY(dbe)->li_playlist = playlist;
|
||||||
|
|
||||||
idle_schedule(IDLE_SYNC, __lib_pl_load, playlist);
|
idle_schedule(IDLE_SYNC, __lib_pl_load, playlist);
|
||||||
|
|
Loading…
Reference in New Issue