From ba229b0708fe3b893a179da3b3635a807b046c4b Mon Sep 17 00:00:00 2001 From: fuxiujun <1365570308@qq.com> Date: Thu, 30 Nov 2023 21:32:48 +0800 Subject: [PATCH] fix(event): fix lv_obj_clean not send event (#4902) Signed-off-by: yushuailong1 Co-authored-by: yushuailong1 --- src/core/lv_obj_tree.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/lv_obj_tree.c b/src/core/lv_obj_tree.c index 47f3b9bf2..3e2549c8b 100644 --- a/src/core/lv_obj_tree.c +++ b/src/core/lv_obj_tree.c @@ -100,6 +100,7 @@ void lv_obj_clean(lv_obj_t * obj) lv_obj_invalidate(obj); + uint32_t cnt = lv_obj_get_child_count(obj); lv_obj_t * child = lv_obj_get_first_not_deleting_child(obj); while(child) { obj_delete_core(child); @@ -112,6 +113,11 @@ void lv_obj_clean(lv_obj_t * obj) obj->spec_attr->scroll.y = 0; } + if(lv_obj_get_child_count(obj) < cnt) { + lv_obj_send_event(obj, LV_EVENT_CHILD_CHANGED, NULL); + lv_obj_send_event(obj, LV_EVENT_CHILD_DELETED, NULL); + } + LV_ASSERT_MEM_INTEGRITY(); LV_LOG_TRACE("finished (clean %p)", (void *)obj);