mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
selection: don't call deselect_dive() from delete_single_dive()
delete_single_dive() is one of those remnants from before the undo-code. Now it is only called in two contexts: 1) When clearing the whole dive log. 2) When importing dives from the cloud on mobile. In the first case, the selection is cleared before deleting the dives. In the second case, let's just do the same. Thus, we can remove the last call to the deselect_dive() function that does some complex calculations concerning the current dive and divecomputer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
487974ea91
commit
1f453094a9
1 changed files with 3 additions and 2 deletions
|
@ -773,8 +773,6 @@ void delete_single_dive(int idx)
|
|||
struct dive *dive = get_dive(idx);
|
||||
if (!dive)
|
||||
return; /* this should never happen */
|
||||
if (dive->selected)
|
||||
deselect_dive(dive);
|
||||
remove_dive_from_trip(dive, divelog.trips);
|
||||
unregister_dive_from_dive_site(dive);
|
||||
delete_dive_from_table(divelog.dives, idx);
|
||||
|
@ -973,6 +971,9 @@ void add_imported_dives(struct divelog *import_log, int flags)
|
|||
process_imported_dives(import_log, flags, &dives_to_add, &dives_to_remove, &trips_to_add,
|
||||
&dive_sites_to_add, devices_to_add);
|
||||
|
||||
/* Start by deselecting all dives, so that we don't end up with an invalid selection */
|
||||
select_single_dive(NULL);
|
||||
|
||||
/* Add new dives to trip and site to get reference count correct. */
|
||||
for (i = 0; i < dives_to_add.nr; i++) {
|
||||
struct dive *d = dives_to_add.dives[i];
|
||||
|
|
Loading…
Reference in a new issue