mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
fix(layout): workaround overflow by implementing a recursion threshold (#1986)
* fix(layout): workaround overflow by implementing a recursion threshold * Update CHANGELOG.md
This commit is contained in:
parent
3dbee9b584
commit
26ab373b43
@ -14,6 +14,7 @@
|
||||
- fix(textarea) buffer overflow in password mode with UTF-8 characters
|
||||
- fix(textarea) cursor position after hiding character in password mode
|
||||
- fix(linemeter) draw critical lines with correct color
|
||||
- fix(layout) stop layout after recursion threshold is reached
|
||||
|
||||
## v7.8.1 (Plannad at 15.12.2020)
|
||||
|
||||
|
@ -27,6 +27,10 @@
|
||||
*********************/
|
||||
#define LV_OBJX_NAME "lv_cont"
|
||||
|
||||
#ifndef LV_LAYOUT_MAX_RECURSION
|
||||
#define LV_LAYOUT_MAX_RECURSION 10
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@ -664,6 +668,10 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
return;
|
||||
}
|
||||
|
||||
static int recursion_level = 0;
|
||||
recursion_level++;
|
||||
/*Ensure it won't keep recursing forever*/
|
||||
if(recursion_level <= LV_LAYOUT_MAX_RECURSION) {
|
||||
lv_area_t tight_area;
|
||||
lv_area_t ori;
|
||||
lv_obj_t * child_i;
|
||||
@ -800,6 +808,11 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
child_i->signal_cb(child_i, LV_SIGNAL_PARENT_SIZE_CHG, &ori);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LV_LOG_ERROR("LV_LAYOUT_MAX_RECURSION reached! You may have encountered issue #1539.");
|
||||
}
|
||||
|
||||
recursion_level--;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user