Planner: don't recreate the dive while cleaning up the widgets

Otherwise the change to the Cylinder widget would trigger a recreation of
the dive in an inconsistent state.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-05-30 16:12:35 -07:00
parent a0136a3b8c
commit 6f1e071a54

View file

@ -764,6 +764,7 @@ void DivePlannerPointsModel::clear()
} else { } else {
stagingDive = alloc_dive(); stagingDive = alloc_dive();
} }
bool oldRecalc = setRecalc(false);
CylindersModel::instance()->setDive(stagingDive); CylindersModel::instance()->setDive(stagingDive);
if (rowCount() > 0) { if (rowCount() > 0) {
beginRemoveRows(QModelIndex(), 0, rowCount() - 1); beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
@ -771,6 +772,7 @@ void DivePlannerPointsModel::clear()
endRemoveRows(); endRemoveRows();
} }
CylindersModel::instance()->clear(); CylindersModel::instance()->clear();
setRecalc(oldRecalc);
} }
void DivePlannerPointsModel::addDecoToModel() void DivePlannerPointsModel::addDecoToModel()