fix(timer): fix working with nested lv_async_calls

fixes: #3940
This commit is contained in:
Gabor Kiss-Vamosi
2023-01-25 10:54:31 +01:00
parent 2b3fbdfaa5
commit 37bed3221e
2 changed files with 11 additions and 2 deletions

View File

@@ -390,6 +390,12 @@ static void obj_del_core(lv_obj_t * obj)
indev = lv_indev_get_next(indev);
}
/*Delete all pending async del-s*/
lv_res_t async_cancel_res = LV_RES_OK;
while(async_cancel_res == LV_RES_OK) {
async_cancel_res = lv_async_call_cancel(lv_obj_del_async_cb, obj);
}
/*All children deleted. Now clean up the object specific data*/
_lv_obj_destruct(obj);

View File

@@ -98,8 +98,11 @@ lv_res_t lv_async_call_cancel(lv_async_cb_t async_xcb, void * user_data)
static void lv_async_timer_cb(lv_timer_t * timer)
{
/*Save the info because an lv_async_call_cancel might delete it in the callback*/
lv_async_info_t * info = (lv_async_info_t *)timer->user_data;
info->cb(info->user_data);
lv_async_info_t info_save = *info;
lv_timer_del(timer);
lv_free(info);
info_save.cb(info_save.user_data);
}