Set rarch_settings_t * lists to NULL after setting_list_free calls -

messy manual bookkeeping
This commit is contained in:
twinaphex 2014-10-11 01:36:04 +02:00
parent e7f5112044
commit fba88a14cb
3 changed files with 12 additions and 2 deletions

View File

@ -177,6 +177,9 @@ void menu_free_list(void *data)
settings_list_free(menu->list_mainmenu); settings_list_free(menu->list_mainmenu);
settings_list_free(menu->list_settings); settings_list_free(menu->list_settings);
menu->list_mainmenu = NULL;
menu->list_settings = NULL;
} }
bool menu_init_list(void *data) bool menu_init_list(void *data)

View File

@ -179,6 +179,8 @@ int menu_entries_push_list(menu_handle_t *menu,
if (!strcmp(label, "mainmenu")) if (!strcmp(label, "mainmenu"))
{ {
settings_list_free(menu->list_mainmenu); settings_list_free(menu->list_mainmenu);
menu->list_mainmenu = NULL;
menu->list_mainmenu = (rarch_setting_t *) menu->list_mainmenu = (rarch_setting_t *)
setting_data_get_list(SL_FLAG_MAIN_MENU); setting_data_get_list(SL_FLAG_MAIN_MENU);
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(menu->list_mainmenu, "Main Menu"); rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(menu->list_mainmenu, "Main Menu");
@ -201,6 +203,8 @@ int menu_entries_push_list(menu_handle_t *menu,
else if (menu_type == MENU_FILE_CATEGORY) else if (menu_type == MENU_FILE_CATEGORY)
{ {
settings_list_free(menu->list_settings); settings_list_free(menu->list_settings);
menu->list_settings = NULL;
menu->list_settings = (rarch_setting_t *) menu->list_settings = (rarch_setting_t *)
setting_data_get_list(SL_FLAG_ALL_SETTINGS); setting_data_get_list(SL_FLAG_ALL_SETTINGS);
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(menu->list_settings, rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(menu->list_settings,
@ -234,6 +238,8 @@ int menu_entries_push_list(menu_handle_t *menu,
else if (!strcmp(label, "settings")) else if (!strcmp(label, "settings"))
{ {
settings_list_free(menu->list_settings); settings_list_free(menu->list_settings);
menu->list_settings = NULL;
menu->list_settings = (rarch_setting_t *) menu->list_settings = (rarch_setting_t *)
setting_data_get_list(SL_FLAG_ALL_SETTINGS); setting_data_get_list(SL_FLAG_ALL_SETTINGS);
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(menu->list_settings, rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(menu->list_settings,
@ -429,7 +435,9 @@ int menu_entries_push_list(menu_handle_t *menu,
else if (!strcmp(label, "Input Options")) else if (!strcmp(label, "Input Options"))
{ {
rarch_setting_t *setting_data = (rarch_setting_t*)menu->list_settings; rarch_setting_t *setting_data = (rarch_setting_t*)menu->list_settings;
settings_list_free(setting_data); settings_list_free(menu->list_settings);
menu->list_settings = NULL;
setting_data = (rarch_setting_t *) setting_data = (rarch_setting_t *)
setting_data_get_list(SL_FLAG_ALL_SETTINGS); setting_data_get_list(SL_FLAG_ALL_SETTINGS);
file_list_clear(list); file_list_clear(list);

View File

@ -111,7 +111,6 @@ void settings_list_free(rarch_setting_t *list)
{ {
if (list) if (list)
free(list); free(list);
list = NULL;
} }
rarch_setting_t *settings_list_new(unsigned size) rarch_setting_t *settings_list_new(unsigned size)