mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(layout): wrong layout counter (#4501)
This commit is contained in:
parent
da876e4a21
commit
5c984b4a53
@ -52,13 +52,12 @@ void _lv_layout_init(void)
|
||||
|
||||
uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data)
|
||||
{
|
||||
layout_cnt++;
|
||||
layout_list_def = lv_realloc(layout_list_def, layout_cnt * sizeof(lv_layout_dsc_t));
|
||||
layout_list_def = lv_realloc(layout_list_def, (layout_cnt + 1) * sizeof(lv_layout_dsc_t));
|
||||
LV_ASSERT_MALLOC(layout_list_def);
|
||||
|
||||
layout_list_def[layout_cnt - 1].cb = cb;
|
||||
layout_list_def[layout_cnt - 1].user_data = user_data;
|
||||
return layout_cnt; /*No -1 to skip 0th index*/
|
||||
layout_list_def[layout_cnt].cb = cb;
|
||||
layout_list_def[layout_cnt].user_data = user_data;
|
||||
return layout_cnt++;
|
||||
}
|
||||
|
||||
void _lv_layout_apply(lv_obj_t * obj)
|
||||
|
Loading…
x
Reference in New Issue
Block a user