fix(screen): fix crash when starting two screen loads with animations (#5066)
This commit is contained in:
@@ -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
|
/*If another screen load animation is in progress
|
||||||
*make target screen loaded immediately. */
|
*make target screen loaded immediately. */
|
||||||
if(d->scr_to_load && act_scr != d->scr_to_load) {
|
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_anim_delete(d->scr_to_load, NULL);
|
||||||
lv_obj_set_pos(d->scr_to_load, 0, 0);
|
lv_obj_set_pos(d->scr_to_load, 0, 0);
|
||||||
lv_obj_remove_local_style_prop(d->scr_to_load, LV_STYLE_OPA, 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);
|
lv_obj_delete(act_scr);
|
||||||
}
|
}
|
||||||
act_scr = lv_screen_active(); /*Active screen changed.*/
|
act_scr = lv_screen_active(); /*Active screen changed.*/
|
||||||
|
|
||||||
|
scr_load_internal(d->scr_to_load);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->scr_to_load = new_scr;
|
d->scr_to_load = new_scr;
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ void test_screen_load_no_crash(void)
|
|||||||
lv_obj_del(screen);
|
lv_obj_del(screen);
|
||||||
screen = lv_obj_create(NULL);
|
screen = lv_obj_create(NULL);
|
||||||
lv_screen_load(screen);
|
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
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user