From b2b3544f3f3c9dc3995a778722a5b2ca4cadd238 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 1 Nov 2020 00:58:35 +0100 Subject: 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 --- core/divelist.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core') 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); -- cgit v1.2.3-70-g09d2