aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-21 22:19:59 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-21 22:31:03 -0700
commita6e9db196f8b04c0e62b1cbd78c85b32b5169f70 (patch)
tree82def5c20434697fc276042fe248f6e7130e2eef /qt-ui/simplewidgets.cpp
parent83a5778f62dcea4ab98c795c9a15cef4a7a82b17 (diff)
downloadsubsurface-a6e9db196f8b04c0e62b1cbd78c85b32b5169f70.tar.gz
Initialize members
Globe: initialize doubleClick member ShiftTimesDialog: initialize when (not sure this could be a problem) SetpointDialog: dc could be uninitialized or could be 0 and dereferenced Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index d060e3892..c86094d13 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -181,13 +181,15 @@ void SetpointDialog::setpointData(struct divecomputer *divecomputer, int second)
void SetpointDialog::buttonClicked(QAbstractButton *button)
{
- if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
+ if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole && dc)
add_event(dc, time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()), "SP change");
mark_divelist_changed(true);
MainWindow::instance()->graphics()->replot();
}
-SetpointDialog::SetpointDialog(QWidget *parent) : QDialog(parent)
+SetpointDialog::SetpointDialog(QWidget *parent) :
+ QDialog(parent),
+ dc(0)
{
ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
@@ -251,7 +253,9 @@ void ShiftTimesDialog::changeTime()
ui.shiftedTime->setText(get_dive_date_string(amount + when));
}
-ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent)
+ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) :
+ QDialog(parent),
+ when(0)
{
ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));