From 0839342d335bef8312845d0c57a81d08a13f657c Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Tue, 28 Nov 2017 20:23:47 +0100 Subject: 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 --- qt-models/diveplannermodel.cpp | 18 +++++++++--------- 1 file 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) -- cgit v1.2.3-70-g09d2