diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-03-17 08:19:09 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-17 10:53:49 -0700 |
commit | 37794e2e236fbbc4a1a55724df3bb1ef160a9ae7 (patch) | |
tree | 54130255d041e1019fb48eb5e2a7fb35b634f249 /qt-ui/maintab.cpp | |
parent | 60ceb8ebc1afb196e66f7decb494c9e4e67fed7a (diff) | |
download | subsurface-37794e2e236fbbc4a1a55724df3bb1ef160a9ae7.tar.gz |
Be more careful about dive computer selection
The selection logic was a bit random: some places would return NULL if
the dive computer index was out of range, others would return the
primary dive computer, and actually moving between dive computers would
just blindly increment and decrement the number.
This always selects the primary computer if the index is out of bounds,
and makes sure we stay in bound when switching beteen dive computers
(but switching between dives can then turn an in-bound number into an
out-of-bounds one)
Fixes #464
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 378ee6163..660fc4f90 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -483,7 +483,7 @@ void MainTab::updateDiveInfo(int dive) get_gas_used(d, gases); QString volumes = get_volume_string(gases[0], true); int mean[MAX_CYLINDERS], duration[MAX_CYLINDERS]; - per_cylinder_mean_depth(d, select_dc(&d->dc), mean, duration); + per_cylinder_mean_depth(d, select_dc(d), mean, duration); volume_t sac; QString SACs; if (mean[0] && duration[0]) { @@ -864,13 +864,13 @@ void MainTab::on_divemaster_textChanged() void MainTab::on_airtemp_textChanged(const QString &text) { - EDIT_SELECTED_DIVES(select_dc(&mydive->dc)->airtemp.mkelvin = parseTemperatureToMkelvin(text)); + EDIT_SELECTED_DIVES(select_dc(mydive)->airtemp.mkelvin = parseTemperatureToMkelvin(text)); markChangedWidget(ui.airtemp); } void MainTab::on_watertemp_textChanged(const QString &text) { - EDIT_SELECTED_DIVES(select_dc(&mydive->dc)->watertemp.mkelvin = parseTemperatureToMkelvin(text)); + EDIT_SELECTED_DIVES(select_dc(mydive)->watertemp.mkelvin = parseTemperatureToMkelvin(text)); markChangedWidget(ui.watertemp); } |