From 1a3ea5636a7671e18c9f220e3ba181ef62740df8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 13 Nov 2013 21:56:51 +0900 Subject: Don't change gas used in segments if there is still a cylinder with that gas Otherwise adding a second cylinder (to the default one cylinder of air) and subsequently changing the gas of that cylinder will illogically change the gas used in all the segments. Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 65a358489..6bc67ada0 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -1303,6 +1303,11 @@ void DivePlannerPointsModel::tanksUpdated() // either nothing relevant changed, or exactly ONE gasmix changed for (int i = 0; i < gases.length(); i++) { if (gases.at(i) != oldGases.at(i)) { + if (oldGases.count(oldGases.at(i)) > 1) { + // we had this gas more than once, so don't + // change segments that used this gas as it still exists + break; + } for (int j = 0; j < rowCount(); j++) { divedatapoint& p = divepoints[j]; int o2 = oldGases.at(i).first; -- cgit v1.2.3-70-g09d2