Cover more edge cases for crashes initiated by Zarch

This commit is contained in:
twinaphex 2016-02-29 01:49:58 +01:00
parent 09f2b64c1f
commit 65b628cf20
2 changed files with 12 additions and 6 deletions

View File

@ -97,8 +97,10 @@ static void gfx_ctx_x_destroy_resources(gfx_ctx_x_data_t *x)
{ {
if (x->g_hw_ctx) if (x->g_hw_ctx)
glXDestroyContext(g_x11_dpy, x->g_hw_ctx); glXDestroyContext(g_x11_dpy, x->g_hw_ctx);
glXDestroyContext(g_x11_dpy, x->g_ctx); if (x->g_ctx)
x->g_ctx = NULL; glXDestroyContext(g_x11_dpy, x->g_ctx);
x->g_ctx = NULL;
x->g_hw_ctx = NULL; x->g_hw_ctx = NULL;
} }
} }

View File

@ -1254,7 +1254,8 @@ static void zarch_context_reset(void *data)
static int zarch_iterate(void *data, void *userdata, enum menu_action action) static int zarch_iterate(void *data, void *userdata, enum menu_action action)
{ {
int action_id; int ret;
size_t selection;
menu_entry_t entry; menu_entry_t entry;
menu_handle_t *menu = (menu_handle_t*)data; menu_handle_t *menu = (menu_handle_t*)data;
zui_t *zui = (zui_t*)userdata; zui_t *zui = (zui_t*)userdata;
@ -1264,17 +1265,20 @@ static int zarch_iterate(void *data, void *userdata, enum menu_action action)
if (!zui) if (!zui)
return -1; return -1;
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &action_id)) if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return 0; return 0;
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER); BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
BIT64_SET(menu->state, MENU_STATE_BLIT); BIT64_SET(menu->state, MENU_STATE_BLIT);
menu_entry_get(&entry, 0, action_id, NULL, false); menu_entry_get(&entry, 0, selection, NULL, false);
zui->action = action; zui->action = action;
return menu_entry_action(&entry, action_id, action); ret = menu_entry_action(&entry, selection, action);
if (ret)
return -1;
return 0;
} }
static bool zarch_menu_init_list(void *data) static bool zarch_menu_init_list(void *data)