lv_obj_del: remove from the group before delete the children (DEFOCUS might need children)

This commit is contained in:
Gabor Kiss-Vamosi
2018-06-14 11:17:49 +02:00
parent 1cac01280a
commit 2a15cffbb9

View File

@@ -265,6 +265,16 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
{ {
lv_obj_invalidate(obj); lv_obj_invalidate(obj);
/*Delete from the group*/
#if USE_LV_GROUP
if(obj->group_p != NULL) lv_group_remove_obj(obj);
#endif
/*Remove the animations from this object*/
#if USE_LV_ANIMATION
lv_anim_del(obj, NULL);
#endif
/*Recursively delete the children*/ /*Recursively delete the children*/
lv_obj_t * i; lv_obj_t * i;
lv_obj_t * i_next; lv_obj_t * i_next;
@@ -279,15 +289,14 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
/*Set i to the next node*/ /*Set i to the next node*/
i = i_next; i = i_next;
} }
#if USE_LV_ANIMATION
/*Remove the animations from this object*/
lv_anim_del(obj, NULL);
#endif
/*Delete from the group*/ /*Remove the object from parent's children list*/
#if USE_LV_GROUP lv_obj_t * par = lv_obj_get_parent(obj);
if(obj->group_p != NULL) lv_group_remove_obj(obj); if(par == NULL) { /*It is a screen*/
#endif lv_ll_rem(&scr_ll, obj);
} else {
lv_ll_rem(&(par->child_ll), obj);
}
/* Reset all input devices if /* Reset all input devices if
* the currently pressed object is deleted*/ * the currently pressed object is deleted*/
@@ -299,14 +308,6 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
indev = lv_indev_next(indev); indev = lv_indev_next(indev);
} }
/*Remove the object from parent's children list*/
lv_obj_t * par = lv_obj_get_parent(obj);
if(par == NULL) { /*It is a screen*/
lv_ll_rem(&scr_ll, obj);
} else {
lv_ll_rem(&(par->child_ll), obj);
}
/* All children deleted. /* All children deleted.
* Now clean up the object specific data*/ * Now clean up the object specific data*/
obj->signal_func(obj, LV_SIGNAL_CLEANUP, NULL); obj->signal_func(obj, LV_SIGNAL_CLEANUP, NULL);