Skip to content

Commit 65b7597

Browse files
committed
Resist attempts to close GraphDlg while running
1 parent 1398c1e commit 65b7597

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/gui/GraphDlg.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ GraphDlg::~GraphDlg()
104104
delete ui;
105105
}
106106

107+
void GraphDlg::reject()
108+
{
109+
if ( !dataTimer.isActive() )
110+
QDialog::reject();
111+
}
112+
107113
void GraphDlg::reloadGraphs()
108114
{
109115
ui->plot->clearGraphs();
@@ -161,7 +167,7 @@ void GraphDlg::replot()
161167
bool rangeFound;
162168
QCPRange range = ui->plot->graph()->getKeyRange(rangeFound);
163169

164-
DataPoint point;
170+
DataPoint point {0., 0.};
165171

166172
if ( initial && q[0]->pop(point) ) {
167173
initial = false;
@@ -170,7 +176,7 @@ void GraphDlg::replot()
170176

171177
int i = 0;
172178
double fac;
173-
double tNow;
179+
double tNow = 0.;
174180
for ( auto &queue : q ) {
175181
if ( Graphp[i].isVoltage )
176182
fac = 1e3;

src/include/GraphDlg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public slots:
4141
void startPlotting(DCThread *);
4242
void stopPlotting();
4343
void reloadGraphs();
44+
void reject();
4445
};
4546

4647
#endif

0 commit comments

Comments
 (0)