fix(obj): check obj->is_deleting at the beginning of obj_del_core (#4525)

Signed-off-by: wangxuedong <wangxuedong@xiaomi.com>
This commit is contained in:
xaowang96 2023-09-06 18:00:36 +08:00 committed by GitHub
parent 217e989a43
commit 8d6c24b40d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -372,12 +372,15 @@ static void lv_obj_del_async_cb(void * obj)
static void obj_del_core(lv_obj_t * obj)
{
if(obj->is_deleting)
return;
obj->is_deleting = true;
/*Let the user free the resources used in `LV_EVENT_DELETE`*/
lv_res_t res = lv_obj_send_event(obj, LV_EVENT_DELETE, NULL);
if(res == LV_RES_INV) return;
obj->is_deleting = true;
/*Clean registered event_cb*/
uint32_t event_cnt = lv_obj_get_event_count(obj);
for(uint32_t i = 0; i < event_cnt; i++) {