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>
This commit is contained in:
Dirk Hohndel 2014-05-28 22:12:53 -07:00
parent 4ed8b5f86f
commit 03eba8f99d

View file

@ -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) {