fix(leak): fix custom style memory leak (#4794)
Signed-off-by: XiaoweiYan <yanxiaowei@xiaomi.com> Co-authored-by: XiaoweiYan <yanxiaowei@xiaomi.com>
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
#define MY_CLASS &lv_obj_class
|
#define MY_CLASS &lv_obj_class
|
||||||
#define style_refr LV_GLOBAL_DEFAULT()->style_refresh
|
#define style_refr LV_GLOBAL_DEFAULT()->style_refresh
|
||||||
#define style_trans_ll_p &(LV_GLOBAL_DEFAULT()->style_trans_ll)
|
#define style_trans_ll_p &(LV_GLOBAL_DEFAULT()->style_trans_ll)
|
||||||
#define style_custom_prop_flag_lookup_table LV_GLOBAL_DEFAULT()->style_custom_prop_flag_lookup_table
|
#define _style_custom_prop_flag_lookup_table LV_GLOBAL_DEFAULT()->style_custom_prop_flag_lookup_table
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
@@ -82,6 +82,10 @@ void _lv_obj_style_init(void)
|
|||||||
void _lv_obj_style_deinit(void)
|
void _lv_obj_style_deinit(void)
|
||||||
{
|
{
|
||||||
_lv_ll_clear(style_trans_ll_p);
|
_lv_ll_clear(style_trans_ll_p);
|
||||||
|
if(_style_custom_prop_flag_lookup_table != NULL) {
|
||||||
|
lv_free(_style_custom_prop_flag_lookup_table);
|
||||||
|
_style_custom_prop_flag_lookup_table = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector)
|
void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector)
|
||||||
@@ -399,13 +403,15 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern const uint8_t _lv_style_builtin_prop_flag_lookup_table[];
|
extern const uint8_t _lv_style_builtin_prop_flag_lookup_table[];
|
||||||
bool inheritable;
|
bool inheritable = false;
|
||||||
if(prop < _LV_STYLE_NUM_BUILT_IN_PROPS) {
|
if(prop < _LV_STYLE_NUM_BUILT_IN_PROPS) {
|
||||||
inheritable = _lv_style_builtin_prop_flag_lookup_table[prop] & LV_STYLE_PROP_FLAG_INHERITABLE;
|
inheritable = _lv_style_builtin_prop_flag_lookup_table[prop] & LV_STYLE_PROP_FLAG_INHERITABLE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
inheritable = style_custom_prop_flag_lookup_table[prop - _LV_STYLE_NUM_BUILT_IN_PROPS] &
|
if(_style_custom_prop_flag_lookup_table != NULL) {
|
||||||
LV_STYLE_PROP_FLAG_INHERITABLE;
|
inheritable = _style_custom_prop_flag_lookup_table[prop - _LV_STYLE_NUM_BUILT_IN_PROPS] &
|
||||||
|
LV_STYLE_PROP_FLAG_INHERITABLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inheritable) {
|
if(inheritable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user