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) <noreply@anthropic.com>
This commit is contained in:
3djc
2026-06-30 11:45:13 +10:00
committed by GitHub
co-authored by raphaelcoeffic Claude Opus 4.8
parent d34582686b
commit 3d189a901c
+11 -1
View File
@@ -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);
}