Fix crashes with '--disable-menu' and the Qt frontend.

When failing to load content in the companion ui when HAVE_MENU is not
defined RetroArch will crash in just about every input and video driver.
Even if several sanity checks are added the dummy core will immediately
exit.

Now it will print that it failed to load the core in the companion ui
and reinit the dummy core to match the behavior with the null menu
driver.
This commit is contained in:
orbea 2019-01-09 08:39:31 -08:00
parent db36f08920
commit 7eead5c59f
3 changed files with 19 additions and 5 deletions

View File

@ -82,10 +82,13 @@ bool content_reset_savestate_backups(void);
bool content_undo_load_buf_is_empty(void);
bool content_undo_save_buf_is_empty(void);
/* Clears the pending subsystem rom buffer*/
/* Checks if launched from the commandline */
bool content_launched_from_cli(void);
/* Clears the pending subsystem rom buffer */
bool content_is_subsystem_pending_load(void);
/* Clears the pending subsystem rom buffer*/
/* Clears the pending subsystem rom buffer */
void content_clear_subsystem(void);
/* Set the current subsystem*/

View File

@ -1406,9 +1406,12 @@ bool retroarch_main_init(int argc, char *argv[])
/* Handle core initialization failure */
if (init_failed)
{
#ifdef HAVE_MENU
/* Check if menu was active prior to core initialization */
if (menu_driver_is_alive())
if (!content_launched_from_cli()
#ifdef HAVE_MENU
|| menu_driver_is_alive()
#endif
)
{
/* Attempt initializing dummy core */
current_core_type = CORE_TYPE_DUMMY;
@ -1416,7 +1419,6 @@ bool retroarch_main_init(int argc, char *argv[])
goto error;
}
else
#endif
{
/* Fall back to regular error handling */
goto error;

View File

@ -138,6 +138,7 @@ struct content_information_ctx
};
static struct string_list *temporary_content = NULL;
static bool _launched_from_cli = true;
static bool _content_is_inited = false;
static bool core_does_not_need_content = false;
static uint32_t content_rom_crc = 0;
@ -1603,6 +1604,8 @@ bool task_push_load_content_with_new_core_from_companion_ui(
command_event(CMD_EVENT_LOAD_CORE, NULL);
#endif
_launched_from_cli = false;
/* Load content */
if (!task_load_content_callback(content_info, true, false))
return false;
@ -1758,6 +1761,12 @@ void content_clear_subsystem(void)
}
}
/* Checks if launched from the commandline */
bool content_launched_from_cli()
{
return _launched_from_cli;
}
/* Get the current subsystem */
int content_get_subsystem()
{