Make this code somewhat more like the other menu drivers

This commit is contained in:
twinaphex 2017-05-28 15:13:18 +02:00
parent 721c6bc5bb
commit 6c5d5ea497
3 changed files with 14 additions and 2 deletions

View File

@ -396,7 +396,7 @@ void driver_uninit(int flags)
core_info_free_current_core();
#ifdef HAVE_MENU
if (flags & DRIVER_MENU_MASK)
if (flags & DRIVER_MENU_MASK && !menu_driver_ctl(RARCH_MENU_CTL_OWNS_DRIVER, NULL))
menu_driver_ctl(RARCH_MENU_CTL_DEINIT, NULL);
#endif
@ -415,6 +415,9 @@ void driver_uninit(int flags)
if (flags & DRIVER_AUDIO_MASK)
audio_driver_deinit();
if ((flags & DRIVER_MENU_MASK) && !menu_driver_ctl(RARCH_MENU_CTL_OWNS_DRIVER, NULL))
menu_driver_destroy_data();
if ((flags & DRIVER_VIDEO_MASK) && !video_driver_owns_driver())
video_driver_destroy_data();

View File

@ -1688,6 +1688,11 @@ void menu_driver_set_thumbnail_content(char *s, size_t len)
menu_driver_ctx->set_thumbnail_content(menu_userdata, s, len);
}
void menu_driver_destroy_data(void)
{
menu_driver_ctx = NULL;
}
void menu_driver_destroy(void)
{
menu_driver_pending_quick_menu = false;
@ -1697,7 +1702,6 @@ void menu_driver_destroy(void)
menu_driver_load_no_content = false;
menu_driver_alive = false;
menu_driver_data_own = false;
menu_driver_ctx = NULL;
menu_userdata = NULL;
}
@ -1847,7 +1851,10 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_input_ctl(MENU_INPUT_CTL_DEINIT, NULL);
if (menu_driver_ctx && menu_driver_ctx->free)
{
menu_driver_ctx->free(menu_userdata);
menu_driver_ctx = NULL;
}
if (menu_userdata)
free(menu_userdata);

View File

@ -685,6 +685,8 @@ void menu_display_reset_textures_list(const char *texture_path, const char *icon
void menu_driver_destroy(void);
void menu_driver_destroy_data(void);
extern uintptr_t menu_display_white_texture;
extern menu_display_ctx_driver_t menu_display_ctx_gl;