aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 22:12:53 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 22:15:44 -0700
commit03eba8f99d414d455b2ce04d8a04bd8177bd0358 (patch)
tree1f3b57e068b59afc2c24be7ba9a7a0ca060cae2d /qt-ui
parent4ed8b5f86f50ab1a85855bb28f2656f7d27a4905 (diff)
downloadsubsurface-03eba8f99d414d455b2ce04d8a04bd8177bd0358.tar.gz
Planner: always recreate staging dive
Instead of even trying to keep one around (which then could cause all kinds of trouble) we now always delete it at the end of the planner. So simply always recreate one when starting the planner (and make sure that the staging dive has always been cleared out, first). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index b6fce75ca..fd6eee504 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -751,12 +751,11 @@ void DivePlannerPointsModel::tanksUpdated()
void DivePlannerPointsModel::clear()
{
+ Q_ASSERT(stagingDive == 0);
if (mode == ADD) {
stagingDive = current_dive;
} else {
- if (!stagingDive)
- stagingDive = alloc_dive();
- memset(stagingDive->cylinder, 0, MAX_CYLINDERS * sizeof(cylinder_t));
+ stagingDive = alloc_dive();
}
CylindersModel::instance()->setDive(stagingDive);
if (rowCount() > 0) {