summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-11-27 16:59:58 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-27 22:40:16 +0100
commit07bd8e6455c7ad4c40f00adebb8d7e9cfc316fb4 (patch)
tree8a9159c2e666c003cc30e9e52bc53293cea7f1be /desktop-widgets
parent8212a923b22a8aa942c3b95ed1d4110bd6fd21a7 (diff)
downloadsubsurface-07bd8e6455c7ad4c40f00adebb8d7e9cfc316fb4.tar.gz
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 <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp3
1 files changed, 3 insertions, 0 deletions
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 = &current_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;
}