fix(settings): recreate entry scroll-reset timer after one-shot delete

The one-shot LVGL timer's callback deleted the timer but left
_entry_scroll_reset_timer dangling. On the 2nd+ screen entry show()
took the 'else' path and called lv_timer_reset() on freed memory, so
the view was never reset to the top — it stayed wherever the group
re-focus had auto-scrolled it (the bottom). Null the pointer before
lv_timer_del so each entry recreates a fresh timer.
This commit is contained in:
Torlando
2026-09-04 13:40:45 +00:00
parent f62f465958
commit d33ae5bb6f
+4
View File
@@ -1410,6 +1410,10 @@ void SettingsScreen::set_status_callback(StatusScreenCallback callback) {
}
void SettingsScreen::entry_scroll_reset_cb(lv_timer_t* timer) {
// One-shot: null the owning pointer BEFORE deleting so the next show()
// recreates the timer. (Skipping the null-out leaves a dangling pointer
// and lv_timer_reset() on freed memory — no reset on the 2nd+ entry.)
_entry_scroll_reset_timer = nullptr;
lv_timer_del(timer);
SettingsScreen* screen = g_settings_entry_reset;
g_settings_entry_reset = nullptr;