From ec8e109a1a67a34deb00dbd8c2d4107d46e95499 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 1 Nov 2019 18:09:03 +0100 Subject: 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 --- profile-widget/profilewidget2.cpp | 7 ------- profile-widget/profilewidget2.h | 1 - 2 files changed, 8 deletions(-) (limited to 'profile-widget') diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 186638a41..40bd92fb9 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -839,13 +839,6 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict #endif } -void ProfileWidget2::recalcCeiling() -{ -#ifndef SUBSURFACE_MOBILE - diveCeiling->recalc(); -#endif -} - void ProfileWidget2::dateTimeChanged() { emit dateTimeChangedItems(); diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 2956b18a5..a5895da63 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -87,7 +87,6 @@ public: bool eventFilter(QObject *, QEvent *) override; void clearHandlers(); #endif - void recalcCeiling(); void setToolTipVisibile(bool visible); State currentState; int animSpeed; -- cgit v1.2.3-70-g09d2