1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(anim): fix user after free if the anim. is delete in the exec_cb (#7173)

This commit is contained in:
Gabor Kiss-Vamosi 2024-10-30 05:40:10 +01:00 committed by GitHub
parent 37ea110238
commit 3f3de6ac71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -547,13 +547,15 @@ static void anim_timer(lv_timer_t * param)
if(!state.anim_list_changed && a->custom_exec_cb) a->custom_exec_cb(a, new_value);
}
/*Restore the original time to see is there is over time.
*Restore only if it wasn't changed in the `exec_cb` for some special reasons.*/
if(a->act_time == act_time_before_exec) a->act_time = act_time_original;
if(!state.anim_list_changed) {
/*Restore the original time to see is there is over time.
*Restore only if it wasn't changed in the `exec_cb` for some special reasons.*/
if(a->act_time == act_time_before_exec) a->act_time = act_time_original;
/*If the time is elapsed the animation is ready*/
if(!state.anim_list_changed && a->act_time >= a->duration) {
anim_completed_handler(a);
/*If the time is elapsed the animation is ready*/
if(a->act_time >= a->duration) {
anim_completed_handler(a);
}
}
}
}