mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-08 18:36:28 +00:00
Don't touch global->core_info.current from outside runloop.c
This commit is contained in:
parent
df17c38598
commit
65eeb3d836
@ -551,9 +551,7 @@ void menu_free(menu_handle_t *menu)
|
||||
if (global->core_info.list)
|
||||
core_info_list_free(global->core_info.list);
|
||||
|
||||
if (global->core_info.current)
|
||||
free(global->core_info.current);
|
||||
global->core_info.current = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_FREE, NULL);
|
||||
|
||||
free(menu);
|
||||
}
|
||||
@ -606,8 +604,7 @@ void *menu_init(const void *data)
|
||||
if (!menu_entries_init(menu))
|
||||
goto error;
|
||||
|
||||
global->core_info.current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
||||
if (!global->core_info.current)
|
||||
if (!runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_INIT, NULL))
|
||||
goto error;
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
|
@ -1629,7 +1629,7 @@ int rarch_defer_core(void *data, const char *dir,
|
||||
#ifdef HAVE_MENU
|
||||
if (menu_label_hash == MENU_LABEL_LOAD_CONTENT)
|
||||
{
|
||||
info = (const core_info_t*)&global->core_info.current;
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, (void*)&info);
|
||||
|
||||
if (info)
|
||||
{
|
||||
|
20
runloop.c
20
runloop.c
@ -521,6 +521,26 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
return true;
|
||||
case RUNLOOP_CTL_HAS_CORE_OPTIONS:
|
||||
return runloop_system.core_options;
|
||||
case RUNLOOP_CTL_CURRENT_CORE_FREE:
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global)
|
||||
return false;
|
||||
if (global->core_info.current)
|
||||
free(global->core_info.current);
|
||||
global->core_info.current = NULL;
|
||||
}
|
||||
return true;
|
||||
case RUNLOOP_CTL_CURRENT_CORE_INIT:
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global)
|
||||
return false;
|
||||
global->core_info.current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
||||
if (!global->core_info.current)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case RUNLOOP_CTL_CURRENT_CORE_GET:
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
@ -70,6 +70,8 @@ enum runloop_ctl_state
|
||||
RUNLOOP_CTL_SET_PERFCNT_ENABLE,
|
||||
RUNLOOP_CTL_UNSET_PERFCNT_ENABLE,
|
||||
RUNLOOP_CTL_IS_PERFCNT_ENABLE,
|
||||
RUNLOOP_CTL_CURRENT_CORE_FREE,
|
||||
RUNLOOP_CTL_CURRENT_CORE_INIT,
|
||||
RUNLOOP_CTL_CURRENT_CORE_GET,
|
||||
RUNLOOP_CTL_DATA_DEINIT,
|
||||
/* Checks for state changes in this frame. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user