While learning how to create new widget I was looking in to msgbox
widget code and noticed that after child objects created for some reason called LV_ASSERT_MALLOC(obj);
where parent obj
passed as parameter, but not pointer to child object that was just created.
See:
lines: 129, 130
mbox->content = lv_obj_class_create_obj(&lv_msgbox_content_class, obj);
LV_ASSERT_MALLOC(obj);
lines: 144, 145
mbox->header = lv_obj_class_create_obj(&lv_msgbox_header_class, obj);
LV_ASSERT_MALLOC(obj);
…and many other places in this file where similar appears.
Why so?? obj
is a parent object that was created long before and successful allocation was checked.
Shouldn’t it be like:
mbox->header = lv_obj_class_create_obj(&lv_msgbox_header_class, obj);
LV_ASSERT_MALLOC(mbox->header);
Below there is usually correct check for null pointer to child object. Just there will not be any output done by LV_ASSERT_MALLOC
for obj
. Right?