summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 21:34:10 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 21:34:10 -0700
commitff7bff48b8687f24c46a5885d318cb9e7cea6246 (patch)
treebd798ebd9b97628effbe93e55f176bc72fe819b4
parent6576790ff62f663b7092411ef23babfb9b52e080 (diff)
downloadsubsurface-ff7bff48b8687f24c46a5885d318cb9e7cea6246.tar.gz
Planner: make sure stagingDive is reset to NULL
If we first ADD a dive and then PLAN a dive, stagingDive first was an alias to the current_dive (for ADD) - we need to make sure that when PLAN is started, a new dive is allocated. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/diveplanner.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index c3ba26932..b6fce75ca 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -316,6 +316,8 @@ void DivePlannerWidget::decoSacChanged(const QString &decosac)
void DivePlannerPointsModel::setPlanMode(Mode m)
{
mode = m;
+ if (m == NOTHING)
+ stagingDive = NULL;
}
bool DivePlannerPointsModel::isPlanner()
@@ -671,10 +673,9 @@ void DivePlannerPointsModel::cancelPlan()
}
}
- if (mode != ADD) {
+ if (mode != ADD) // for ADD stagingDive points at current_dive
free(stagingDive);
- stagingDive = NULL;
- }
+ stagingDive = NULL; // always reset the stagingDive to NULL
setPlanMode(NOTHING);
diveplan.dp = NULL;
emit planCanceled();