mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-01 00:51:49 +08:00
fix(disp) fix memory leak in lv_disp_remove (#2355)
Co-authored-by: wangxuedong <wangxuedong@xiaomi.com>
This commit is contained in:
@@ -220,6 +220,20 @@ void lv_disp_remove(lv_disp_t * disp)
|
|||||||
|
|
||||||
_lv_ll_remove(&LV_GC_ROOT(_lv_disp_ll), disp);
|
_lv_ll_remove(&LV_GC_ROOT(_lv_disp_ll), disp);
|
||||||
lv_timer_del(disp->refr_timer);
|
lv_timer_del(disp->refr_timer);
|
||||||
|
|
||||||
|
/** delete screen and other obj */
|
||||||
|
if (disp->sys_layer) {
|
||||||
|
lv_obj_del(disp->sys_layer);
|
||||||
|
disp->sys_layer = NULL;
|
||||||
|
}
|
||||||
|
if (disp->top_layer) {
|
||||||
|
lv_obj_del(disp->top_layer);
|
||||||
|
disp->top_layer = NULL;
|
||||||
|
}
|
||||||
|
while (disp->screen_cnt != 0) {
|
||||||
|
/*Delete the screenst*/
|
||||||
|
lv_obj_del(disp->screens[0]);
|
||||||
|
}
|
||||||
lv_mem_free(disp);
|
lv_mem_free(disp);
|
||||||
|
|
||||||
if(was_default) lv_disp_set_default(_lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll)));
|
if(was_default) lv_disp_set_default(_lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll)));
|
||||||
|
|||||||
Reference in New Issue
Block a user