From 07bd8e6455c7ad4c40f00adebb8d7e9cfc316fb4 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Mon, 27 Nov 2017 16:59:58 +0100 Subject: After edit the cylinders of a dive copy the full samples After editing the cylinder table (e.g. deleting a cylinder) and accepting the changes copy the whole dc samples for the dive edited. This is important because the sensor idx in the samples may have changed. Signed-off-by: Stefan Fuchs --- desktop-widgets/tab-widgets/maintab.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 80ee2d9f4..3a2b3af89 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -862,12 +862,15 @@ void MainTab::acceptChanges() cd->cylinder[i].type.description = copy_string(displayed_dive.cylinder[i].type.description); } /* if cylinders changed we may have changed gas change events + * and sensor idx in samples as well * - so far this is ONLY supported for a single selected dive */ struct divecomputer *tdc = ¤t_dive->dc; struct divecomputer *sdc = &displayed_dive.dc; while(tdc && sdc) { free_events(tdc->events); copy_events(sdc, tdc); + free(tdc->sample); + copy_samples(sdc, tdc); tdc = tdc->next; sdc = sdc->next; } -- cgit v1.2.3-70-g09d2