diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index f6d30507e..0ccbb23f4 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -67,10 +67,10 @@ void _lv_obj_style_init(void); /** * Add a style to an object. * @param obj pointer to an object - * @param part a part of the object to which the style should be added E.g. `LV_PART_MAIN` or `LV_PART_KNOB` - * @param state a state or combination of states to which the style should be assigned * @param style pointer to a style to add - * @example lv_obj_add_style_no_refresh(slider, LV_PART_KNOB, LV_STATE_PRESSED, &style1); + * @param selector OR-ed value of parts and state to which the style should be added + * @example lv_obj_add_style(btn, &style_btn, 0); //Default button style + * @example lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed */ void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector); @@ -79,9 +79,9 @@ void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selec * @param obj pointer to an object * @param style pointer to a style to remove. Can be NULL to check only the selector * @param selector OR-ed values of states and a part to remove only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used - * @example lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, &style); //Remove a specific style - * @example lv_obj_remove_style(obj, LV_PART_MAIN, LV_STATE_ANY, &style); //Remove all styles from the main part - * @example lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, NULL); //Remove all styles + * @example lv_obj_remove_style(obj, &style, LV_PART_ANY | LV_STATE_ANY); //Remove a specific style + * @example lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part + * @example lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles */ void lv_obj_remove_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector); diff --git a/src/extra/widgets/span/lv_span.c b/src/extra/widgets/span/lv_span.c index d43e4f1cf..ad40baaa1 100644 --- a/src/extra/widgets/span/lv_span.c +++ b/src/extra/widgets/span/lv_span.c @@ -137,6 +137,7 @@ void lv_spangroup_del_span(lv_obj_t * obj, lv_span_t * span) if(cur_span->txt && cur_span->static_flag == 0) { lv_mem_free(cur_span->txt); } + lv_style_reset(&cur_span->style); lv_mem_free(cur_span); break; } @@ -501,6 +502,7 @@ static void lv_spangroup_destructor(const lv_obj_class_t * class_p, lv_obj_t * o if(cur_span->txt && cur_span->static_flag == 0) { lv_mem_free(cur_span->txt); } + lv_style_reset(&cur_span->style); lv_mem_free(cur_span); cur_span = _lv_ll_get_head(&spans->child_ll); }