mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix dive computer copying
When copying a dive, we need to copy all the dive computers, but the first one is special since it is embedded inside the "struct dive". We had special case code for that case, but it only copied the samples and events. Use the proper "copy_dc()" for the primary dive computer copying too, which gets all the details right. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7e15c2a7ad
commit
b3b43e0140
1 changed files with 3 additions and 4 deletions
7
dive.c
7
dive.c
|
|
@ -474,11 +474,10 @@ void copy_dive(struct dive *s, struct dive *d)
|
||||||
d->weightsystem[i].description = copy_string(s->weightsystem[i].description);
|
d->weightsystem[i].description = copy_string(s->weightsystem[i].description);
|
||||||
STRUCTURED_LIST_COPY(struct picture, s->picture_list, d->picture_list, copy_pl);
|
STRUCTURED_LIST_COPY(struct picture, s->picture_list, d->picture_list, copy_pl);
|
||||||
STRUCTURED_LIST_COPY(struct tag_entry, s->tag_list, d->tag_list, copy_tl);
|
STRUCTURED_LIST_COPY(struct tag_entry, s->tag_list, d->tag_list, copy_tl);
|
||||||
|
|
||||||
|
/* Copy the embedded dc first, then copy the list */
|
||||||
|
copy_dc(&s->dc, &d->dc);
|
||||||
STRUCTURED_LIST_COPY(struct divecomputer, s->dc.next, d->dc.next, copy_dc);
|
STRUCTURED_LIST_COPY(struct divecomputer, s->dc.next, d->dc.next, copy_dc);
|
||||||
/* this only copied dive computers 2 and up. The first dive computer is part
|
|
||||||
* of the struct dive, so let's make copies of its samples and events */
|
|
||||||
copy_samples(&s->dc, &d->dc);
|
|
||||||
copy_events(&s->dc, &d->dc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make a clone of the source dive and clean out the source dive;
|
/* make a clone of the source dive and clean out the source dive;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue