From abd5d81b7076862db6176385e2bb0f790a225172 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 5 Sep 2016 12:46:28 -0400 Subject: [PATCH] fix core unload when closing content --- command.c | 28 ++++++++++++++++------------ runloop.c | 6 +++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/command.c b/command.c index e688d481cd..fcc6a90690 100644 --- a/command.c +++ b/command.c @@ -1778,8 +1778,10 @@ static void command_event_main_state(unsigned cmd) void handle_quit_event() { + settings_t *settings = config_get_ptr(); #ifdef HAVE_MENU - if (menu_popup_is_active()) + if (settings && settings->confirm_on_exit && + menu_popup_is_active()) return; #endif @@ -1980,19 +1982,21 @@ bool command_event(enum event_command cmd, void *data) command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL); command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL); - if (content_is_inited()) - if (!task_push_content_load_default( - NULL, NULL, - &content_info, - CORE_TYPE_DUMMY, - CONTENT_MODE_LOAD_NOTHING_WITH_DUMMY_CORE, - NULL, NULL)) - return false; + if (content_is_inited()) + if (!task_push_content_load_default( + NULL, NULL, + &content_info, + CORE_TYPE_DUMMY, + CONTENT_MODE_LOAD_NOTHING_WITH_DUMMY_CORE, + NULL, NULL)) + return false; #ifndef HAVE_DYNAMIC - core_unload_game(); - core_unload(); + core_unload_game(); + core_unload(); +#else + command_event(CMD_EVENT_LOAD_CORE_DEINIT, NULL); #endif - break; + break; case CMD_EVENT_QUIT_CONFIRM: handle_quit_event(); break; diff --git a/runloop.c b/runloop.c index 8cc78df1a4..2c105f2ba9 100644 --- a/runloop.c +++ b/runloop.c @@ -1355,12 +1355,12 @@ static INLINE int runloop_iterate_time_to_exit(bool quit_key_pressed) return 1; #ifdef HAVE_MENU - if (!runloop_quit_confirm && menu_popup_is_active()) - return 1; - if (settings && settings->confirm_on_exit && !runloop_quit_confirm) { + if (menu_popup_is_active()) + return 1; + if (content_is_inited()) { if(menu_display_toggle_get_reason() != MENU_TOGGLE_REASON_USER)