From 03eba8f99d414d455b2ce04d8a04bd8177bd0358 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 28 May 2014 22:12:53 -0700 Subject: 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 --- qt-ui/diveplanner.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'qt-ui') 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) { -- cgit v1.2.3-70-g09d2