diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-11-01 18:09:03 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-11-08 20:42:06 +0100 |
commit | ec8e109a1a67a34deb00dbd8c2d4107d46e95499 (patch) | |
tree | 967b05ab88ab37327000c02acd79ae51b312da30 /desktop-widgets | |
parent | a3a3913e1e8955da0dd65011b4c5e67803e2c4da (diff) | |
download | subsurface-ec8e109a1a67a34deb00dbd8c2d4107d46e95499.tar.gz |
Profile: remove ProfileWidget2::recalcCeiling()
The ProfileWidget2::recalcCeiling() function is used in one place,
namely when an undo-command changes the mode. It recalculates
decompression data and repaints the ceilings and thus avoids a
full profile-redraw.
This is smart, but it becomes problematic when the dive is changed
and the ceiling is recalculated before the profile is redrawn.
The DivePlotDataModel then still has data from the previous dive
but cylinders of the new dive are accessed.
This kind of situation may arise if multiple dive fields are
updated, as for example when replanning a dive.
Currently, this only causes a temporary mis-calculation. When
removing MAX_CYLINDERS this will lead to crashes.
One might attempt to fix the whole data-dependency mess. This
commit goes the cheap route and simply redraws the profile when
the mode is changed. Yes, it is in a way ineffective, but we
do worse things. The ProfileWidget2::recalcCeiling() thus becomes
unused and is removed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 3418fbddd..3aea3fe39 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -355,7 +355,7 @@ void MainTab::updateNotes(const struct dive *d) void MainTab::updateMode(struct dive *d) { ui.DiveType->setCurrentIndex(get_dive_dc(d, dc_number)->divemode); - MainWindow::instance()->graphics->recalcCeiling(); + MainWindow::instance()->graphics->replot(); } static QDateTime timestampToDateTime(timestamp_t when) |