[Color] delete first all widgets before loading the new ones

This commit is contained in:
Raphael Coeffic
2021-06-20 19:00:12 +02:00
parent 46e8ca43e7
commit dc49c662ca
@@ -92,14 +92,15 @@ class WidgetsContainerImpl: public WidgetsContainer
{ {
unsigned int count = getZonesCount(); unsigned int count = getZonesCount();
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
// remove old widget // remove old widget
if (widgets[i]) { if (widgets[i]) {
removeField(widgets[i]); removeField(widgets[i]);
widgets[i]->deleteLater(); widgets[i]->deleteLater();
widgets[i] = nullptr; widgets[i] = nullptr;
} }
}
for (unsigned int i = 0; i < count; i++) {
// and load new one if required // and load new one if required
if (persistentData->zones[i].widgetName[0]) { if (persistentData->zones[i].widgetName[0]) {
char name[WIDGET_NAME_LEN + 1]; char name[WIDGET_NAME_LEN + 1];