(Menu) We need to tell rarch_menu_running_finished whether we want

to exit RetroArch or not - to avoid certain crashes when trying to
access the settings pointer - which should already be freed at this
point
This commit is contained in:
twinaphex 2019-06-30 11:22:26 +02:00
parent c23a61eb6e
commit f4bf218f35
8 changed files with 21 additions and 18 deletions

View File

@ -1913,7 +1913,7 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_MENU_TOGGLE:
#ifdef HAVE_MENU
if (menu_driver_is_alive())
rarch_menu_running_finished();
rarch_menu_running_finished(false);
else
rarch_menu_running();
#endif
@ -2452,7 +2452,7 @@ TODO: Add a setting for these tweaks */
#endif
break;
case CMD_EVENT_RESUME:
rarch_menu_running_finished();
rarch_menu_running_finished(false);
if (ui_companion_is_on_foreground())
ui_companion_driver_toggle(false);
break;

View File

@ -261,7 +261,7 @@ static void handle_discord_join_response(void *ignore, const char *line)
#ifdef HAVE_MENU
menu_input_dialog_end();
rarch_menu_running_finished();
rarch_menu_running_finished(false);
#endif
*/
}

View File

@ -5291,7 +5291,7 @@ static void action_ok_netplay_enable_client_hostname_cb(
}
menu_input_dialog_end();
rarch_menu_running_finished();
rarch_menu_running_finished(false);
}
#endif

View File

@ -295,7 +295,7 @@ static void handshake_password(void *ignore, const char *line)
#ifdef HAVE_MENU
menu_input_dialog_end();
rarch_menu_running_finished();
rarch_menu_running_finished(false);
#endif
}
#endif

View File

@ -14404,7 +14404,7 @@ void rarch_menu_running(void)
#endif
}
void rarch_menu_running_finished(void)
void rarch_menu_running_finished(bool quit)
{
#if defined(HAVE_MENU) || defined(HAVE_OVERLAY)
const settings_t *settings = (const settings_t*)configuration_settings;
@ -14415,14 +14415,17 @@ void rarch_menu_running_finished(void)
/* Prevent stray input */
input_driver_flushing_input = true;
/* Stop menu background music before we exit the menu */
if (settings->bools.audio_enable_menu && settings->bools.audio_enable_menu_bgm)
audio_driver_mixer_stop_stream(AUDIO_MIXER_SYSTEM_SLOT_BGM);
if (!quit)
/* Stop menu background music before we exit the menu */
if (settings->bools.audio_enable_menu && settings->bools.audio_enable_menu_bgm)
audio_driver_mixer_stop_stream(AUDIO_MIXER_SYSTEM_SLOT_BGM);
#endif
video_driver_set_texture_enable(false, false);
#ifdef HAVE_OVERLAY
if (settings->bools.input_overlay_hide_in_menu)
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
if (!quit)
if (settings->bools.input_overlay_hide_in_menu)
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
#endif
}
@ -15593,7 +15596,7 @@ bool retroarch_main_quit(void)
}
rarch_ctl(RARCH_CTL_SET_SHUTDOWN, NULL);
rarch_menu_running_finished();
rarch_menu_running_finished(true);
return true;
}
@ -16089,7 +16092,7 @@ static enum runloop_state runloop_check_state(
}
if (!menu_driver_iterate(&iter))
rarch_menu_running_finished();
rarch_menu_running_finished(false);
if (focused || !runloop_idle)
{
@ -16173,7 +16176,7 @@ static enum runloop_state runloop_check_state(
{
if (rarch_is_initialized && !core_type_is_dummy)
{
rarch_menu_running_finished();
rarch_menu_running_finished(false);
menu_event_kb_set(false, RETROK_F1);
}
}
@ -16185,7 +16188,7 @@ static enum runloop_state runloop_check_state(
if (menu_driver_is_alive())
{
if (rarch_is_initialized && !core_type_is_dummy)
rarch_menu_running_finished();
rarch_menu_running_finished(false);
}
else
{

View File

@ -417,7 +417,7 @@ void runloop_unset(enum runloop_action action);
void rarch_menu_running(void);
void rarch_menu_running_finished(void);
void rarch_menu_running_finished(bool quit);
bool retroarch_is_on_main_thread(void);

View File

@ -1383,7 +1383,7 @@ bool task_push_load_content_from_playlist_from_menu(
command_event(CMD_EVENT_LOAD_CORE, NULL);
#else
rarch_ctl(RARCH_CTL_SET_SHUTDOWN, NULL);
rarch_menu_running_finished();
rarch_menu_running_finished(true);
#endif
end:

View File

@ -67,7 +67,7 @@ static void rarch_disable_ui(void)
rarch_ctl(RARCH_CTL_SET_PAUSED, &boolean);
rarch_ctl(RARCH_CTL_SET_IDLE, &boolean);
rarch_menu_running_finished();
rarch_menu_running_finished(false);
}
static void ui_companion_cocoatouch_event_command(