From 00944f7a02c98bd281778218bccc592896386f14 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 6 Aug 2019 11:19:32 +0200 Subject: Core: pass dive, cylinder-id to fill_default_cylinder The fill_default_cylinder() function calculated the MOD based on the currently displayed dive. This does not seem to make sense: - When importing dives, why would we care about the altitude and salinity of the currently displayed dive, possibly from a different trip. - The planner is supposed to be thread-safe and should not touch global variables. Of course this means that the importing-functions have to fill out altitude and salinity before creating the default cylinder, but this is their problem. For a freshly created dive they will get the default values, which still seems less random than the values from the displayed dive. Signed-off-by: Berthold Stoeger --- qt-models/diveplannermodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-models/diveplannermodel.cpp') diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 47d2bf275..c2bbdf084 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -165,7 +165,7 @@ void DivePlannerPointsModel::setupCylinders() return; // We have at least one cylinder } if (!empty_string(prefs.default_cylinder)) { - fill_default_cylinder(&displayed_dive.cylinder[0]); + fill_default_cylinder(&displayed_dive, 0); displayed_dive.cylinder[0].start = displayed_dive.cylinder[0].type.workingpressure; } if (cylinder_none(&displayed_dive.cylinder[0])) { -- cgit v1.2.3-70-g09d2