diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-11-28 20:23:47 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-12-01 15:47:51 -0800 |
commit | 0839342d335bef8312845d0c57a81d08a13f657c (patch) | |
tree | 4b5f3fc777541a08b20a784e1e6dfacba0ba38f0 /qt-models | |
parent | f6b00fb3dda5529775c6044554da4d9f1a328047 (diff) | |
download | subsurface-0839342d335bef8312845d0c57a81d08a13f657c.tar.gz |
Don't block profile updates in variations computation
We needed to prevent updates when we messed with the
diveplannerpointsmodel as those would trigger
starting planning from scratch causing infinite loops.
Now, the variations calculation operates on a copy of
the diveplan, so the model is no longer involved and
we should not block recalculations (as those might be
triggered by the UI).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/diveplannermodel.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 2d03a672b..f549a0378 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -1022,7 +1022,7 @@ int DivePlannerPointsModel::analyzeVariations(struct decostop *min, struct decos void DivePlannerPointsModel::computeVariations(struct diveplan *original_plan, struct deco_state *previos_ds) { - bool oldRecalc = setRecalc(false); +// bool oldRecalc = setRecalc(false); struct dive *dive = alloc_dive(); copy_dive(&displayed_dive, dive); struct decostop original[60], deeper[60], shallower[60], shorter[60], longer[60]; @@ -1032,7 +1032,7 @@ void DivePlannerPointsModel::computeVariations(struct diveplan *original_plan, s struct deco_state ds = *previos_ds; if(!original_plan) { - setRecalc(oldRecalc); +// setRecalc(oldRecalc); return; } @@ -1083,19 +1083,19 @@ void DivePlannerPointsModel::computeVariations(struct diveplan *original_plan, s plan(&ds, &plan_copy, dive, 1, shorter, &cache, true, false); free_dps(&plan_copy); restore_deco_state(save, &ds, false); -finish: - free_dps(original_plan); - free(original_plan); -#ifdef SHOWSTOPVARIATIONS - printf("\n\n"); -#endif char buf[200]; sprintf(buf, "+ %d:%02d /m + %d:%02d /min", FRACTION(analyzeVariations(shallower, original, deeper, "m"),60), FRACTION(analyzeVariations(shorter, original, longer, "min"), 60)); emit variationsComputed(QString(buf)); +#ifdef SHOWSTOPVARIATIONS + printf("\n\n"); +#endif } - setRecalc(oldRecalc); +finish: + free_dps(original_plan); + free(original_plan); +// setRecalc(oldRecalc); } void DivePlannerPointsModel::createPlan(bool replanCopy) |