Explore: Fix freeing of cached playlist (it could cause a crash in glui menu when jumping up multiple menu lists)
Also makes setting cached_playlist with an external list less of a hack and simplifies menu_explore.c a bit
This commit is contained in:
parent
e0ffe8184f
commit
5da2ada6b8
|
@ -486,8 +486,7 @@ static void explore_free(explore_state_t *state)
|
||||||
EX_BUF_FREE(state->entries);
|
EX_BUF_FREE(state->entries);
|
||||||
|
|
||||||
for (i = 0; i != EX_BUF_LEN(state->playlists); i++)
|
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_BUF_FREE(state->playlists);
|
||||||
ex_arena_free(&state->arena);
|
ex_arena_free(&state->arena);
|
||||||
}
|
}
|
||||||
|
@ -968,16 +967,6 @@ unsigned menu_displaylist_explore(file_list_t *list)
|
||||||
" '%s'", explore_state->find_string);
|
" '%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
|
if ( current_type == MENU_EXPLORE_TAB
|
||||||
|| current_type == EXPLORE_TYPE_ADDITIONALFILTER)
|
|| current_type == EXPLORE_TYPE_ADDITIONALFILTER)
|
||||||
{
|
{
|
||||||
|
@ -1218,8 +1207,7 @@ SKIP_ENTRY:;
|
||||||
|
|
||||||
/* Fake all the state so the content screen
|
/* Fake all the state so the content screen
|
||||||
* and information screen think we're viewing via playlist */
|
* and information screen think we're viewing via playlist */
|
||||||
playlist_set_cached(pl);
|
playlist_set_cached_external(pl);
|
||||||
explore_state->cached_playlist = pl;
|
|
||||||
menu->rpl_entry_selection_ptr = (pl_entry - pl_first);
|
menu->rpl_entry_selection_ptr = (pl_entry - pl_first);
|
||||||
strlcpy(menu->deferred_path,
|
strlcpy(menu->deferred_path,
|
||||||
pl_entry->path, sizeof(menu->deferred_path));
|
pl_entry->path, sizeof(menu->deferred_path));
|
||||||
|
|
16
playlist.c
16
playlist.c
|
@ -56,6 +56,7 @@ struct content_playlist
|
||||||
bool modified;
|
bool modified;
|
||||||
bool old_format;
|
bool old_format;
|
||||||
bool compressed;
|
bool compressed;
|
||||||
|
bool cached_external;
|
||||||
|
|
||||||
enum playlist_label_display_mode label_display_mode;
|
enum playlist_label_display_mode label_display_mode;
|
||||||
enum playlist_thumbnail_mode right_thumbnail_mode;
|
enum playlist_thumbnail_mode right_thumbnail_mode;
|
||||||
|
@ -107,9 +108,11 @@ typedef int (playlist_sort_fun_t)(
|
||||||
|
|
||||||
/* TODO/FIXME - hack for allowing the explore view to switch
|
/* TODO/FIXME - hack for allowing the explore view to switch
|
||||||
* over to a playlist item */
|
* over to a playlist item */
|
||||||
void playlist_set_cached(playlist_t* pl)
|
void playlist_set_cached_external(playlist_t* pl)
|
||||||
{
|
{
|
||||||
|
playlist_free_cached();
|
||||||
playlist_cached = pl;
|
playlist_cached = pl;
|
||||||
|
playlist_cached->cached_external = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convenience function: copies specified playlist
|
/* Convenience function: copies specified playlist
|
||||||
|
@ -1386,9 +1389,10 @@ void playlist_write_runtime_file(playlist_t *playlist)
|
||||||
JSON_Writer_WriteNewLine(context.writer);
|
JSON_Writer_WriteNewLine(context.writer);
|
||||||
JSON_Writer_Free(context.writer);
|
JSON_Writer_Free(context.writer);
|
||||||
|
|
||||||
playlist->modified = false;
|
playlist->modified = false;
|
||||||
playlist->old_format = false;
|
playlist->old_format = false;
|
||||||
playlist->compressed = false;
|
playlist->compressed = false;
|
||||||
|
playlist->cached_external = false;
|
||||||
|
|
||||||
RARCH_LOG("[Playlist]: Written to playlist file: %s\n", playlist->config.path);
|
RARCH_LOG("[Playlist]: Written to playlist file: %s\n", playlist->config.path);
|
||||||
end:
|
end:
|
||||||
|
@ -2609,7 +2613,8 @@ end:
|
||||||
|
|
||||||
void playlist_free_cached(void)
|
void playlist_free_cached(void)
|
||||||
{
|
{
|
||||||
playlist_free(playlist_cached);
|
if (playlist_cached && !playlist_cached->cached_external)
|
||||||
|
playlist_free(playlist_cached);
|
||||||
playlist_cached = NULL;
|
playlist_cached = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2668,6 +2673,7 @@ playlist_t *playlist_init(const playlist_config_t *config)
|
||||||
playlist->modified = false;
|
playlist->modified = false;
|
||||||
playlist->old_format = false;
|
playlist->old_format = false;
|
||||||
playlist->compressed = false;
|
playlist->compressed = false;
|
||||||
|
playlist->cached_external = false;
|
||||||
playlist->size = 0;
|
playlist->size = 0;
|
||||||
playlist->default_core_name = NULL;
|
playlist->default_core_name = NULL;
|
||||||
playlist->default_core_path = 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 */
|
* default core association */
|
||||||
core_info_t *playlist_get_default_core_info(playlist_t* playlist);
|
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
|
RETRO_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue