From 3d189a901c7b166cea27f68a815821aacfd2d0f5 Mon Sep 17 00:00:00 2001 From: 3djc <5167938+3djc@users.noreply.github.com> Date: Tue, 30 Jun 2026 03:45:13 +0200 Subject: [PATCH] fix(color): widget updating in the middle of model change (#7500) Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) --- radio/src/gui/colorlcd/model/model_select.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/colorlcd/model/model_select.cpp b/radio/src/gui/colorlcd/model/model_select.cpp index 1a486915a..2cb2d6518 100644 --- a/radio/src/gui/colorlcd/model/model_select.cpp +++ b/radio/src/gui/colorlcd/model/model_select.cpp @@ -365,8 +365,15 @@ class ModelsPageBody : public Window memcpy(g_eeGeneral.currModelFilename, model->modelFilename, LEN_MODEL_FILENAME); - // Delete old main view layout + // Pause widget refresh + MainWindow::instance()->enableWidgetRefresh(false); + + // Delete old main view layout and top bar widgets: loadModel() can + // re-enter the UI refresh loop (throttle / switch warnings spin + // MainWindow::run()) while g_model is being reset, and a surviving + // widget would then read torn-down persistent data. LayoutFactory::deleteCustomScreens(); + LayoutFactory::deleteTopBarWidgets(); loadModel(g_eeGeneral.currModelFilename, true); modelslist.setCurrentModel(model); @@ -374,6 +381,9 @@ class ModelsPageBody : public Window // Load new main view layout LayoutFactory::loadCustomScreens(); + // Enable widget refresh + MainWindow::instance()->enableWidgetRefresh(true); + storageDirty(EE_GENERAL); storageCheck(true); }