mirror of
https://github.com/lvgl/lvgl.git
synced 2025-02-04 07:13:00 +08:00
fix(leak): fix memory leak on music list (#4732)
Signed-off-by: YanXiaowei <yanxiaowei@xiaomi.com> Co-authored-by: YanXiaowei <yanxiaowei@xiaomi.com>
This commit is contained in:
parent
9e252bdff7
commit
cafc8393a7
@ -24,6 +24,7 @@
|
|||||||
**********************/
|
**********************/
|
||||||
static lv_obj_t * add_list_button(lv_obj_t * parent, uint32_t track_id);
|
static lv_obj_t * add_list_button(lv_obj_t * parent, uint32_t track_id);
|
||||||
static void btn_click_event_cb(lv_event_t * e);
|
static void btn_click_event_cb(lv_event_t * e);
|
||||||
|
static void list_delete_event_cb(lv_event_t * e);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
@ -129,6 +130,7 @@ lv_obj_t * _lv_demo_music_list_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
/*Create an empty transparent container*/
|
/*Create an empty transparent container*/
|
||||||
list = lv_obj_create(parent);
|
list = lv_obj_create(parent);
|
||||||
|
lv_obj_add_event(list, list_delete_event_cb, LV_EVENT_DELETE, NULL);
|
||||||
lv_obj_remove_style_all(list);
|
lv_obj_remove_style_all(list);
|
||||||
lv_obj_set_size(list, LV_HOR_RES, LV_VER_RES - LV_DEMO_MUSIC_HANDLE_SIZE);
|
lv_obj_set_size(list, LV_HOR_RES, LV_VER_RES - LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||||
lv_obj_set_y(list, LV_DEMO_MUSIC_HANDLE_SIZE);
|
lv_obj_set_y(list, LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||||
@ -233,5 +235,21 @@ static void btn_click_event_cb(lv_event_t * e)
|
|||||||
|
|
||||||
_lv_demo_music_play(idx);
|
_lv_demo_music_play(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void list_delete_event_cb(lv_event_t * e)
|
||||||
|
{
|
||||||
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
|
|
||||||
|
if(code == LV_EVENT_DELETE) {
|
||||||
|
lv_style_reset(&style_scrollbar);
|
||||||
|
lv_style_reset(&style_btn);
|
||||||
|
lv_style_reset(&style_button_pr);
|
||||||
|
lv_style_reset(&style_button_chk);
|
||||||
|
lv_style_reset(&style_button_dis);
|
||||||
|
lv_style_reset(&style_title);
|
||||||
|
lv_style_reset(&style_artist);
|
||||||
|
lv_style_reset(&style_time);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif /*LV_USE_DEMO_MUSIC*/
|
#endif /*LV_USE_DEMO_MUSIC*/
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user