Browse Source

thermostat: fix invalid free on exit

master
Richard Genoud 5 years ago
parent
commit
44f0d9f6cd
2 changed files with 10 additions and 10 deletions
  1. +1
    -1
      soft/thermostat/inc/mainwindow.h
  2. +9
    -9
      soft/thermostat/src/mainwindow.cpp

+ 1
- 1
soft/thermostat/inc/mainwindow.h View File

@ -33,7 +33,7 @@ public:
private:
MQTTClient *m_mqtt;
QPushButton m_state_btn;
QPushButton *m_state_btn;
QVector<ZoneItem *> m_zones;
QTimer *m_timer;
BoostDlg *m_boost;


+ 9
- 9
soft/thermostat/src/mainwindow.cpp View File

@ -49,7 +49,7 @@ MainWindow::MainWindow(QWidget *parent) :
*/
QGridLayout *mainLayout = new QGridLayout;
m_state_btn.setText(tr("Auto"));
m_state_btn = new QPushButton("Auto");
QPushButton *menu_btn = new QPushButton(tr("Menu"));
if (s->nbZones() < MAX_NB_ZONES) {
@ -61,7 +61,7 @@ MainWindow::MainWindow(QWidget *parent) :
mainLayout->addWidget(menu_btn, 0, 2);
mainLayout->addWidget(m_zones.at(2), 1, 0);
mainLayout->addWidget(m_zones.at(3), 1, 1);
mainLayout->addWidget(&m_state_btn, 1, 2);
mainLayout->addWidget(m_state_btn, 1, 2);
}
update_state_btn(s->m_state);
@ -73,10 +73,10 @@ MainWindow::MainWindow(QWidget *parent) :
font.setPointSize(12);
font.setBold(true);
menu_btn->setFont(font);
m_state_btn.setFont(font);
m_state_btn->setFont(font);
menu_btn->setSizePolicy(*szPolicy);
m_state_btn.setSizePolicy(*szPolicy);
m_state_btn->setSizePolicy(*szPolicy);
QWidget *mainWidget = new QWidget;
mainWidget->setLayout(mainLayout);
@ -107,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(this, SIGNAL(setAllHeatersOn(bool)), m_mqtt, SLOT(allHeatersOn(bool)));
connect(m_mqtt, SIGNAL(connected(void)), this, SLOT(apply_order_to_heaters(void)));
connect(&m_state_btn, SIGNAL(clicked()), this, SLOT(change_state()));
connect(m_state_btn, SIGNAL(clicked()), this, SLOT(change_state()));
connect(menu_btn, SIGNAL(clicked()), this, SLOT(show_menu()));
/*
@ -235,16 +235,16 @@ void MainWindow::update_state_btn(enum power_states st)
{
switch (st) {
case OFF:
m_state_btn.setText(tr("Force off"));
m_state_btn->setText(tr("Force off"));
break;
case ON:
m_state_btn.setText(tr("Force on"));
m_state_btn->setText(tr("Force on"));
break;
case AUTO:
m_state_btn.setText(tr("Auto"));
m_state_btn->setText(tr("Auto"));
break;
default:
m_state_btn.setText(tr("Error"));
m_state_btn->setText(tr("Error"));
break;
}
}


Loading…
Cancel
Save