diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 6901f3b1b0..cc8c522ebc 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -213,11 +213,8 @@ static int menu_setting_ok_toggle(unsigned type, } #ifdef HAVE_SHADER_MANAGER else if (!strcmp(label, "video_shader_preset_save_as")) - { - if (action == MENU_ACTION_OK) - menu_key_start_line(driver.menu, "Preset Filename", - label, st_string_callback); - } + menu_key_start_line(driver.menu, "Preset Filename", + label, st_string_callback); else if (!strcmp(label, "shader_apply_changes")) { rarch_main_command(RARCH_CMD_SHADERS_APPLY_CHANGES); @@ -1124,11 +1121,34 @@ static void menu_common_setting_set_label(char *type_str, static void menu_common_list_insert(void *data, const char *path, const char *unused, size_t list_size) { + int i = list_size; + file_list_t *list = (file_list_t*)data; + + if (!list) + return; + + list->list[i].actiondata = (menu_file_list_cbs_t*) + calloc(1, sizeof(menu_file_list_cbs_t)); + + if (!list->list[i].actiondata) + { + RARCH_ERR("Action data could not be allocated.\n"); + return; + } + } static void menu_common_list_delete(void *data, size_t index, size_t list_size) { + file_list_t *list = (file_list_t*)data; + + if (!list) + return; + + if (list->list[index].actiondata) + free(list->list[index].actiondata); + list->list[index].actiondata = NULL; } static void menu_common_list_clear(void *data) diff --git a/frontend/menu/disp/menu_display.h b/frontend/menu/disp/menu_display.h index 8aa06de2a4..e211888f75 100644 --- a/frontend/menu/disp/menu_display.h +++ b/frontend/menu/disp/menu_display.h @@ -5,6 +5,11 @@ extern "C" { #endif +typedef struct menu_file_list_cbs +{ + int (*action_ok)(const char *path, const char *label, unsigned type); +} menu_file_list_cbs_t; + typedef struct menu_ctx_driver { void (*set_texture)(void*); diff --git a/frontend/menu/disp/xmb.c b/frontend/menu/disp/xmb.c index 16734c9a6f..721fff1e70 100644 --- a/frontend/menu/disp/xmb.c +++ b/frontend/menu/disp/xmb.c @@ -736,7 +736,10 @@ static void xmb_list_insert(void *data, list->list[i].userdata = (xmb_node_t*)calloc(1, sizeof(xmb_node_t)); if (!list->list[i].userdata) + { RARCH_ERR("XMB node could not be allocated.\n"); + return; + } xmb_node_t *node = (xmb_node_t*)list->list[i].userdata;