aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/subsurfacewebservices.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-05 22:58:47 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commite2df38d868324f2a767d2109cdd8727acb866ca2 (patch)
tree614b560431d2c61f3f2b1e2f986c7806bd175ae9 /desktop-widgets/subsurfacewebservices.cpp
parentc22fd9f4fd6699333629b8acb1e9c135a9783082 (diff)
downloadsubsurface-e2df38d868324f2a767d2109cdd8727acb866ca2.tar.gz
Dive site: add dive site ref-counting
Instead of setting dive->dive_site directly, call the add_dive_to_dive_site() and unregister_dive_from_dive_site() functions. In the parser this turned out to be a bit tricky. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/subsurfacewebservices.cpp')
-rw-r--r--desktop-widgets/subsurfacewebservices.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp
index e2c787990..36037f511 100644
--- a/desktop-widgets/subsurfacewebservices.cpp
+++ b/desktop-widgets/subsurfacewebservices.cpp
@@ -47,7 +47,8 @@ static void copy_gps_location(struct dive *from, struct dive *to)
struct dive_site *gds = get_dive_site_for_dive(from);
if (!ds) {
// simply link to the one created for the fake dive
- to->dive_site = gds;
+ unregister_dive_from_dive_site(to);
+ add_dive_to_dive_site(to, gds);
} else {
ds->latitude = gds->latitude;
ds->longitude = gds->longitude;