mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 13:14:04 +00:00
(gfx_thumbnail) Fix heap-use-after-free error
This commit is contained in:
parent
d4dd1f71a5
commit
5eee8daa4f
@ -155,6 +155,18 @@ bool gfx_thumbnail_get_fade_missing(bool fade_missing)
|
||||
|
||||
/* Callbacks */
|
||||
|
||||
/* Fade animation callback - simply resets thumbnail
|
||||
* 'fade_active' status */
|
||||
static void gfx_thumbnail_fade_cb(void *userdata)
|
||||
{
|
||||
gfx_thumbnail_t *thumbnail = (gfx_thumbnail_t*)userdata;
|
||||
|
||||
if (!thumbnail)
|
||||
return;
|
||||
|
||||
thumbnail->fade_active = false;
|
||||
}
|
||||
|
||||
/* Initialises thumbnail 'fade in' animation */
|
||||
static void gfx_thumbnail_init_fade(gfx_thumbnail_t *thumbnail)
|
||||
{
|
||||
@ -176,14 +188,15 @@ static void gfx_thumbnail_init_fade(gfx_thumbnail_t *thumbnail)
|
||||
gfx_animation_ctx_entry_t animation_entry;
|
||||
|
||||
thumbnail->alpha = 0.0f;
|
||||
thumbnail->fade_active = true;
|
||||
|
||||
animation_entry.easing_enum = EASING_OUT_QUAD;
|
||||
animation_entry.tag = (uintptr_t)&thumbnail->alpha;
|
||||
animation_entry.duration = p_gfx_thumb->fade_duration;
|
||||
animation_entry.target_value = 1.0f;
|
||||
animation_entry.subject = &thumbnail->alpha;
|
||||
animation_entry.cb = NULL;
|
||||
animation_entry.userdata = NULL;
|
||||
animation_entry.cb = gfx_thumbnail_fade_cb;
|
||||
animation_entry.userdata = thumbnail;
|
||||
|
||||
gfx_animation_push(&animation_entry);
|
||||
}
|
||||
@ -449,14 +462,14 @@ void gfx_thumbnail_reset(gfx_thumbnail_t *thumbnail)
|
||||
if (!thumbnail)
|
||||
return;
|
||||
|
||||
if (thumbnail->texture)
|
||||
{
|
||||
gfx_animation_ctx_tag tag = (uintptr_t)&thumbnail->alpha;
|
||||
|
||||
/* Unload texture */
|
||||
if (thumbnail->texture)
|
||||
video_driver_texture_unload(&thumbnail->texture);
|
||||
|
||||
/* Ensure any 'fade in' animation is killed */
|
||||
if (thumbnail->fade_active)
|
||||
{
|
||||
gfx_animation_ctx_tag tag = (uintptr_t)&thumbnail->alpha;
|
||||
gfx_animation_kill_by_tag(&tag);
|
||||
}
|
||||
|
||||
@ -467,6 +480,7 @@ void gfx_thumbnail_reset(gfx_thumbnail_t *thumbnail)
|
||||
thumbnail->height = 0;
|
||||
thumbnail->alpha = 0.0f;
|
||||
thumbnail->delay_timer = 0.0f;
|
||||
thumbnail->fade_active = false;
|
||||
}
|
||||
|
||||
/* Stream processing */
|
||||
|
@ -72,6 +72,7 @@ typedef struct
|
||||
unsigned height;
|
||||
float alpha;
|
||||
float delay_timer;
|
||||
bool fade_active;
|
||||
} gfx_thumbnail_t;
|
||||
|
||||
/* Holds all configuration parameters associated
|
||||
|
Loading…
x
Reference in New Issue
Block a user