mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-10 04:37:55 +08:00
chore(display): prevent disp_refr from becoming a wild pointer (#6618)
Signed-off-by: yushuailong1 <yushuailong1@xiaomi.com> Co-authored-by: yushuailong1 <yushuailong1@xiaomi.com>
This commit is contained in:
@@ -158,7 +158,9 @@ lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res)
|
||||
void lv_display_delete(lv_display_t * disp)
|
||||
{
|
||||
bool was_default = false;
|
||||
bool was_refr = false;
|
||||
if(disp == lv_display_get_default()) was_default = true;
|
||||
if(disp == lv_refr_get_disp_refreshing()) was_refr = true;
|
||||
|
||||
lv_display_send_event(disp, LV_EVENT_DELETE, NULL);
|
||||
lv_event_remove_all(&(disp->event_list));
|
||||
@@ -205,6 +207,8 @@ void lv_display_delete(lv_display_t * disp)
|
||||
lv_free(disp);
|
||||
|
||||
if(was_default) lv_display_set_default(lv_ll_get_head(disp_ll_p));
|
||||
|
||||
if(was_refr) lv_refr_set_disp_refreshing(NULL);
|
||||
}
|
||||
|
||||
void lv_display_set_default(lv_display_t * disp)
|
||||
|
||||
Reference in New Issue
Block a user