Fixes segfault with environ SHUTDOWN with prboom

This commit is contained in:
twinaphex 2015-03-23 23:40:36 +01:00
parent 189458f661
commit ba938da348
4 changed files with 17 additions and 3 deletions

View File

@ -2385,7 +2385,7 @@ bool rarch_main_command(unsigned cmd)
if (menu)
menu->load_no_content = false;
#endif
rarch_main_data_free();
rarch_main_data_deinit();
*global->fullpath = '\0';
@ -2591,6 +2591,9 @@ bool rarch_main_command(unsigned cmd)
core_info_list_free(global->core_info);
global->core_info = NULL;
break;
case RARCH_CMD_DATA_RUNLOOP_FREE:
rarch_main_data_free();
break;
case RARCH_CMD_CORE_INFO_INIT:
rarch_main_command(RARCH_CMD_CORE_INFO_DEINIT);

View File

@ -193,6 +193,7 @@ enum basic_event
RARCH_CMD_REMAPPING_DEINIT,
RARCH_CMD_VOLUME_UP,
RARCH_CMD_VOLUME_DOWN,
RARCH_CMD_DATA_RUNLOOP_FREE,
};
enum action_state

View File

@ -486,6 +486,8 @@ void rarch_main_state_free(void);
void rarch_main_global_free(void);
void rarch_main_data_deinit(void);
void rarch_main_data_free(void);
void rarch_main_data_init_queues(void);

View File

@ -778,7 +778,7 @@ static void data_runloop_thread_deinit(data_runloop_t *runloop)
}
#endif
void rarch_main_data_free(void)
void rarch_main_data_deinit(void)
{
data_runloop_t *data_runloop = (data_runloop_t*)rarch_main_data_get_ptr();
@ -794,8 +794,15 @@ void rarch_main_data_free(void)
#endif
data_runloop->inited = false;
}
void rarch_main_data_free(void)
{
data_runloop_t *data_runloop = (data_runloop_t*)rarch_main_data_get_ptr();
if (data_runloop)
free(data_runloop);
data_runloop = NULL;
}
static void data_runloop_iterate(bool is_thread, data_runloop_t *runloop)
@ -915,6 +922,7 @@ static data_runloop_t *rarch_main_data_new(void)
void rarch_main_data_clear_state(void)
{
rarch_main_data_deinit();
rarch_main_data_free();
g_data_runloop = rarch_main_data_new();
}