diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-11-01 00:58:35 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-10-31 23:20:59 -0700 |
commit | b2b3544f3f3c9dc3995a778722a5b2ca4cadd238 (patch) | |
tree | 584b9ed02d59ae321d33cd3acb83124540f8dcc4 /core | |
parent | 43f15f1b481dc2dd90e56f87f63a3d01d91bccba (diff) | |
download | subsurface-b2b3544f3f3c9dc3995a778722a5b2ca4cadd238.tar.gz |
core: on import remove merged dives from trip/divesite
When dives were merged on import, they were not unregistered
from their dive site and trip before being deleted. Thus, these
tables had stale pointers, which would ultimate lead to crashes.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/divelist.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/divelist.c b/core/divelist.c index 5d87ccbcb..8552c2689 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -857,6 +857,10 @@ static void merge_imported_dives(struct dive_table *table) merged->dive_site = NULL; add_dive_to_dive_site(merged, ds); } + unregister_dive_from_dive_site(prev); + unregister_dive_from_dive_site(dive); + unregister_dive_from_trip(prev); + unregister_dive_from_trip(dive); /* Overwrite the first of the two dives and remove the second */ free_dive(prev); |