mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 18:20:27 +00:00
Merge pull request #11110 from schellingb/explore_fix_cached_playlist
Explore: Fix freeing of cached playlist
This commit is contained in:
commit
0ae214b2db
@ -486,8 +486,7 @@ static void explore_free(explore_state_t *state)
|
||||
EX_BUF_FREE(state->entries);
|
||||
|
||||
for (i = 0; i != EX_BUF_LEN(state->playlists); i++)
|
||||
if (state->playlists[i] != state->cached_playlist)
|
||||
playlist_free(state->playlists[i]);
|
||||
playlist_free(state->playlists[i]);
|
||||
EX_BUF_FREE(state->playlists);
|
||||
ex_arena_free(&state->arena);
|
||||
}
|
||||
@ -968,16 +967,6 @@ unsigned menu_displaylist_explore(file_list_t *list)
|
||||
" '%s'", explore_state->find_string);
|
||||
}
|
||||
|
||||
if (current_type == MENU_EXPLORE_TAB)
|
||||
{
|
||||
/* free any existing playlist
|
||||
* when entering the explore view */
|
||||
playlist_free_cached();
|
||||
}
|
||||
|
||||
playlist_set_cached(NULL);
|
||||
explore_state->cached_playlist = NULL;
|
||||
|
||||
if ( current_type == MENU_EXPLORE_TAB
|
||||
|| current_type == EXPLORE_TYPE_ADDITIONALFILTER)
|
||||
{
|
||||
@ -1218,8 +1207,7 @@ SKIP_ENTRY:;
|
||||
|
||||
/* Fake all the state so the content screen
|
||||
* and information screen think we're viewing via playlist */
|
||||
playlist_set_cached(pl);
|
||||
explore_state->cached_playlist = pl;
|
||||
playlist_set_cached_external(pl);
|
||||
menu->rpl_entry_selection_ptr = (pl_entry - pl_first);
|
||||
strlcpy(menu->deferred_path,
|
||||
pl_entry->path, sizeof(menu->deferred_path));
|
||||
|
20
playlist.c
20
playlist.c
@ -56,6 +56,7 @@ struct content_playlist
|
||||
bool modified;
|
||||
bool old_format;
|
||||
bool compressed;
|
||||
bool cached_external;
|
||||
|
||||
enum playlist_label_display_mode label_display_mode;
|
||||
enum playlist_thumbnail_mode right_thumbnail_mode;
|
||||
@ -107,9 +108,14 @@ typedef int (playlist_sort_fun_t)(
|
||||
|
||||
/* TODO/FIXME - hack for allowing the explore view to switch
|
||||
* over to a playlist item */
|
||||
void playlist_set_cached(playlist_t* pl)
|
||||
void playlist_set_cached_external(playlist_t* pl)
|
||||
{
|
||||
playlist_cached = pl;
|
||||
playlist_free_cached();
|
||||
if (pl)
|
||||
{
|
||||
playlist_cached = pl;
|
||||
playlist_cached->cached_external = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convenience function: copies specified playlist
|
||||
@ -1386,9 +1392,9 @@ void playlist_write_runtime_file(playlist_t *playlist)
|
||||
JSON_Writer_WriteNewLine(context.writer);
|
||||
JSON_Writer_Free(context.writer);
|
||||
|
||||
playlist->modified = false;
|
||||
playlist->old_format = false;
|
||||
playlist->compressed = false;
|
||||
playlist->modified = false;
|
||||
playlist->old_format = false;
|
||||
playlist->compressed = false;
|
||||
|
||||
RARCH_LOG("[Playlist]: Written to playlist file: %s\n", playlist->config.path);
|
||||
end:
|
||||
@ -2609,7 +2615,8 @@ end:
|
||||
|
||||
void playlist_free_cached(void)
|
||||
{
|
||||
playlist_free(playlist_cached);
|
||||
if (playlist_cached && !playlist_cached->cached_external)
|
||||
playlist_free(playlist_cached);
|
||||
playlist_cached = NULL;
|
||||
}
|
||||
|
||||
@ -2668,6 +2675,7 @@ playlist_t *playlist_init(const playlist_config_t *config)
|
||||
playlist->modified = false;
|
||||
playlist->old_format = false;
|
||||
playlist->compressed = false;
|
||||
playlist->cached_external = false;
|
||||
playlist->size = 0;
|
||||
playlist->default_core_name = NULL;
|
||||
playlist->default_core_path = NULL;
|
||||
|
@ -351,7 +351,7 @@ core_info_t *playlist_entry_get_core_info(const struct playlist_entry* entry);
|
||||
* default core association */
|
||||
core_info_t *playlist_get_default_core_info(playlist_t* playlist);
|
||||
|
||||
void playlist_set_cached(playlist_t* pl);
|
||||
void playlist_set_cached_external(playlist_t* pl);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user