fix(theme): add reentrancy guard to resolution_change_event_cb#10051
fix(theme): add reentrancy guard to resolution_change_event_cb#10051catellie wants to merge 1 commit into
Conversation
lv_theme_default_init() refreshes all widget styles, which marks
layouts dirty and emits display events. When called from
resolution_change_event_cb this creates infinite recursion:
resolution_change_event_cb
-> lv_theme_default_init
-> style refresh -> layout dirty -> display event
-> resolution_change_event_cb (reentrant)
On constrained devices (ESP32) this overflows the stack within
seconds, triggering a task watchdog timeout.
Add a static bool guard so reentrant calls are skipped.
Fixes lvgl#9982
|
Hi 👋, thank you for your PR! We've run benchmarks in an emulated environment. Here are the results: ARM Emulated 32b - lv_conf_perf32b
Detailed Results Per Scene
ARM Emulated 64b - lv_conf_perf64b
Detailed Results Per Scene
Disclaimer: These benchmarks were run in an emulated environment using QEMU with instruction counting mode. 🤖 This comment was automatically generated by a bot. |
|
@AndreCostaaa @FASTSHIFT - any chance to get this in? Preferably before the next bump of EspHome... 🙏 |
Summary
resolution_change_event_cb(added in #9048) callslv_theme_default_init(), which refreshes all widget styles. The style refresh marks layouts dirty and emits display events, which re-enterresolution_change_event_cb-- causing infinite recursion.On ESP32 this overflows the stack within seconds and triggers a task watchdog timeout. Reproducible on any ESP32-S3 running ESPHome with LVGL v9.5.0 when
lv_display_set_resolution()is called during setup.Fix
Add a
static boolreentrancy guard to skip reentrant calls. Minimal, zero-overhead when not recursing.Test plan
task_wdttimeout.Fixes #9982