Pass userdata to context_destroy callback

This commit is contained in:
twinaphex 2015-12-10 16:57:48 +01:00
parent 71548e2e10
commit 02bac66c9e
6 changed files with 13 additions and 18 deletions

View File

@ -1003,11 +1003,10 @@ static void mui_context_bg_destroy(mui_handle_t *mui)
menu_display_texture_unload((uintptr_t*)&mui->textures.white);
}
static void mui_context_destroy(void)
static void mui_context_destroy(void *data)
{
unsigned i;
menu_handle_t *menu = menu_driver_get_ptr();
mui_handle_t *mui = menu ? (mui_handle_t*)menu->userdata : NULL;
mui_handle_t *mui = (mui_handle_t*)data;
if (!mui)
return;

View File

@ -301,7 +301,7 @@ static void *rmenu_init(void)
return menu;
}
static void rmenu_context_destroy(void)
static void rmenu_context_destroy(void *data)
{
texture_image_free(menu_texture);
}

View File

@ -2477,16 +2477,10 @@ static void xmb_list_cache(void *data, menu_list_type_t type, unsigned action)
}
static void xmb_context_destroy(void)
static void xmb_context_destroy(void *data)
{
unsigned i;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
return;
xmb = (xmb_handle_t*)menu->userdata;
xmb_handle_t *xmb = (xmb_handle_t*)data;
if (!xmb)
return;

View File

@ -1117,12 +1117,11 @@ static void zarch_context_bg_destroy(zui_t *zui)
menu_display_texture_unload((uintptr_t*)&zui->textures.white);
}
static void zarch_context_destroy(void)
static void zarch_context_destroy(void *data)
{
menu_handle_t *menu = menu_driver_get_ptr();
zui_t *zui = menu ? (zui_t*)menu->userdata : NULL;
zui_t *zui = (zui_t*)data;
if (!menu || !zui)
if (!zui)
return;
menu_display_free_main_font();

View File

@ -169,9 +169,12 @@ void menu_driver_list_free(file_list_t *list, size_t idx, size_t list_size)
void menu_driver_context_destroy(void)
{
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu || !menu->userdata)
return;
if (driver && driver->context_destroy)
driver->context_destroy();
driver->context_destroy(menu->userdata);
}
void menu_driver_list_set_selection(file_list_t *list)

View File

@ -256,7 +256,7 @@ typedef struct menu_ctx_driver
void* (*init)(void);
void (*free)(void*);
void (*context_reset)(void);
void (*context_destroy)(void);
void (*context_destroy)(void *data);
void (*populate_entries)(void *data,
const char *path, const char *label,
unsigned k);