fix(color): memory leak when creating a blank model (#7541)

This commit is contained in:
philmoz
2026-07-23 13:23:52 +10:00
committed by GitHub
parent b706c40046
commit 1b12ee9283
8 changed files with 28 additions and 35 deletions
@@ -149,6 +149,9 @@ void LayoutFactory::loadDefaultLayout()
//
void LayoutFactory::loadCustomScreens()
{
// Delete old screens
deleteCustomScreens();
unsigned i = 0;
auto viewMain = ViewMain::instance();
@@ -199,10 +199,7 @@ void ScreenSetupPage::build(Window* window)
// Remove this screen from the model
g_model.removeScreenLayout(customScreenIndex);
// Delete all custom screens
LayoutFactory::deleteCustomScreens();
// ... and reload
// Delete and reload custom screens
LayoutFactory::loadCustomScreens();
// adjust index if last screen deleted
@@ -642,6 +642,8 @@ void ModelLabelsWindow::newModel()
luaExecStandalone(path);
}
#endif
} else {
LayoutFactory::loadDefaultLayout();
}
// Main view layout
+1 -3
View File
@@ -127,10 +127,8 @@ HWPots::HWPots(Window* parent) :
potsChanged = false;
setCloseHandler([=]() {
if (potsChanged) {
LayoutFactory::deleteCustomScreens();
if (potsChanged)
LayoutFactory::loadCustomScreens();
}
});
new StaticText(this, {P_NM_X, -PAD_TINY, 0, 0}, STR_NAME, COLOR_THEME_PRIMARY1_INDEX, FONT(XS));