fix(color): memory leak when creating a blank model (#7541)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user