Fix location in result of dive merging

This is the minimal fix to actually include the resulting location in
the merged dive.  I'm not sure what the background was to setting the
dive location only in the "merge_result" variable, and not in the actual
result dive itself.

Berthold says that the whole site handling may be broken:

 "From a quick glance, the code in dive_table::merge_dives looks
  fundamentally broken, because it may overwrite site->location outside
  of the undo system. I.e. this will not be undone."

but the "this will not be undone" is about the site location setting,
and is separate and independent of the dive->dive_set setting.

Presumably we would need to make a copy of the site for the undo
functionality.  That will be for somebody else to worry about, this at
least fixes the resulting location in the dive itsels.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2024-08-28 19:55:20 +12:00 committed by bstoeger
parent da6c753502
commit aa3a93a466

View file

@ -1182,6 +1182,7 @@ merge_result dive_table::merge_dives(const struct dive &a_in, const struct dive
* Keep the dive site, but add the GPS data */
res.site->location = b->dive_site->location;
}
res.dive->dive_site = res.site;
fixup_dive(*res.dive);
return res;