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

fix(screen): fix crash when starting two screen loads with animations (#5066)

This commit is contained in:
Zhongwei Liu 2023-12-21 03:22:57 +08:00 committed by GitHub
parent deb43a2333
commit b2447b7b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -543,7 +543,6 @@ void lv_screen_load_anim(lv_obj_t * new_scr, lv_screen_load_anim_t anim_type, ui
/*If another screen load animation is in progress
*make target screen loaded immediately. */
if(d->scr_to_load && act_scr != d->scr_to_load) {
scr_load_internal(d->scr_to_load);
lv_anim_delete(d->scr_to_load, NULL);
lv_obj_set_pos(d->scr_to_load, 0, 0);
lv_obj_remove_local_style_prop(d->scr_to_load, LV_STYLE_OPA, 0);
@ -552,6 +551,8 @@ void lv_screen_load_anim(lv_obj_t * new_scr, lv_screen_load_anim_t anim_type, ui
lv_obj_delete(act_scr);
}
act_scr = lv_screen_active(); /*Active screen changed.*/
scr_load_internal(d->scr_to_load);
}
d->scr_to_load = new_scr;

View File

@ -10,6 +10,12 @@ void test_screen_load_no_crash(void)
lv_obj_del(screen);
screen = lv_obj_create(NULL);
lv_screen_load(screen);
/*Consecutively loading multiple screens with transition animations should not crash*/
lv_obj_t * screen_with_anim_1 = lv_obj_create(NULL);
lv_obj_t * screen_with_anim_2 = lv_obj_create(NULL);
lv_screen_load_anim(screen_with_anim_1, LV_SCR_LOAD_ANIM_OVER_LEFT, 2000, 0, false);
lv_screen_load_anim(screen_with_anim_2, LV_SCR_LOAD_ANIM_OVER_RIGHT, 1000, 500, false);
}
#endif