mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
playlist: Simplify playlist_load
Reset fd for the on-disk playlist at the place where ownership is transferred in playlist_set_current (which already has a note, that the playlist will be effectively closed, but did not reset the fd). Also ensure, that calling playlist_load closes the fd for the on-disk playlist (and its control file), if any were left open - even though this is not supposed to happen. Generate name of control file in playlist_init to be more consistent with the behavior for the current playlist. Only a single playlist can be loaded in the playlist viewer at the same time, so generating random names shouldn't be needed. Change-Id: I65e0fc07ce608c1d333a90447e18482787a98b8c
This commit is contained in:
parent
5d9b01b9ed
commit
0012411fc5
2 changed files with 26 additions and 26 deletions
|
|
@ -1066,12 +1066,10 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename,
|
|||
struct playlist_entry * current_track =
|
||||
playlist_buffer_get_track(&viewer.buffer,
|
||||
viewer.selected_track);
|
||||
|
||||
int ret_val;
|
||||
if (viewer.moving_track >= 0)
|
||||
{
|
||||
/* Move track */
|
||||
int ret_val;
|
||||
|
||||
ret_val = playlist_move(viewer.playlist,
|
||||
viewer.moving_playlist_index,
|
||||
current_track->index);
|
||||
|
|
@ -1108,7 +1106,12 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename,
|
|||
break;
|
||||
}
|
||||
/* New playlist */
|
||||
if (playlist_set_current(viewer.playlist) < 0)
|
||||
ret_val = playlist_set_current(viewer.playlist);
|
||||
|
||||
/* Playlist effectively closed */
|
||||
viewer.playlist = NULL;
|
||||
|
||||
if (ret_val < 0)
|
||||
goto exit;
|
||||
if (global_settings.playlist_shuffle)
|
||||
start_index = playlist_shuffle(current_tick, start_index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue