diff --git a/command_event.c b/command_event.c index 270c204aba..6ac59c3545 100644 --- a/command_event.c +++ b/command_event.c @@ -1213,12 +1213,7 @@ bool event_command(enum event_command cmd) settings->content_history_size); break; case EVENT_CMD_CORE_INFO_DEINIT: - if (!global) - break; - - if (global->core_info.list) - core_info_list_free(global->core_info.list); - global->core_info.list = NULL; + runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_FREE, NULL); break; case EVENT_CMD_CORE_INFO_INIT: event_command(EVENT_CMD_CORE_INFO_DEINIT); diff --git a/runloop.c b/runloop.c index 5afbe03668..05a96a1f71 100644 --- a/runloop.c +++ b/runloop.c @@ -522,6 +522,17 @@ 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_LIST_FREE: + { + global_t *global = global_get_ptr(); + + if (!global) + return false; + if (global->core_info.list) + core_info_list_free(global->core_info.list); + global->core_info.list = NULL; + } + return true; case RUNLOOP_CTL_CURRENT_CORE_FREE: if (core_info_current) free(core_info_current); diff --git a/runloop.h b/runloop.h index e2b960102c..1e9579ce16 100644 --- a/runloop.h +++ b/runloop.h @@ -70,6 +70,7 @@ enum runloop_ctl_state RUNLOOP_CTL_SET_PERFCNT_ENABLE, RUNLOOP_CTL_UNSET_PERFCNT_ENABLE, RUNLOOP_CTL_IS_PERFCNT_ENABLE, + RUNLOOP_CTL_CURRENT_CORE_LIST_FREE, RUNLOOP_CTL_CURRENT_CORE_FREE, RUNLOOP_CTL_CURRENT_CORE_INIT, RUNLOOP_CTL_CURRENT_CORE_GET,