diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f2e029da..9304c1bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Add `gpu_wait_cb` to wait until the GPU is working. It allows to run CPU a wait only when the rendered data is needed. ### Bugfixes +- Fix `lv_obj_del` and `lv_obj_clean` if the children list changed during deletion. ## v7.4.0 (01.09.2020) diff --git a/lv_conf_template.h b/lv_conf_template.h index d4d419a6c..1cf09a9d8 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -653,7 +653,7 @@ typedef void * lv_obj_user_data_t; * 1: Some extra precision * 2: Best precision */ -# define LV_LINEMETER_PRECISE 0 +# define LV_LINEMETER_PRECISE 1 #endif /*Mask (dependencies: -)*/ diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 30c5f6c6c..25fec838a 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -487,11 +487,8 @@ void lv_obj_clean(lv_obj_t * obj) lv_obj_t * child = lv_obj_get_child(obj, NULL); lv_obj_t * child_next; while(child) { - /* Read the next child before deleting the current - * because the next couldn't be read from a deleted (invalid) node*/ - child_next = lv_obj_get_child(obj, child); lv_obj_del(child); - child = child_next; + child = lv_obj_get_child(obj, NULL); /*Get the new first child*/ } } @@ -3709,17 +3706,13 @@ static void obj_del_core(lv_obj_t * obj) /*Recursively delete the children*/ lv_obj_t * i; - lv_obj_t * i_next; i = _lv_ll_get_head(&(obj->child_ll)); while(i != NULL) { - /*Get the next object before delete this*/ - i_next = _lv_ll_get_next(&(obj->child_ll), i); - - /*Call the recursive del to the child too*/ + /*Call the recursive delete to the child too*/ obj_del_core(i); - /*Set i to the next node*/ - i = i_next; + /*Set i to the new head node*/ + i = _lv_ll_get_head(&(obj->child_ll)); } lv_event_mark_deleted(obj); diff --git a/src/lv_widgets/lv_linemeter.c b/src/lv_widgets/lv_linemeter.c index cd7f291c0..a8c9d3db8 100644 --- a/src/lv_widgets/lv_linemeter.c +++ b/src/lv_widgets/lv_linemeter.c @@ -76,6 +76,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy) ext->line_cnt = 18; ext->scale_angle = 240; ext->angle_ofs = 0; + ext->mirrored = 0; /*The signal and design functions are not copied so set them here*/ lv_obj_set_signal_cb(linemeter, lv_linemeter_signal);