diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-12-08 22:57:39 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-12-14 00:29:31 +0800 |
commit | dfd7f98129c2b9cb862ac414a84c5d82ffa407d0 (patch) | |
tree | efaeb467e93c99a2bf231d33abec1d409905cba7 /core/compressibility.r | |
parent | 662dd823fddecacb903ebb4a7a22fa7ebcc8391b (diff) | |
download | subsurface-dfd7f98129c2b9cb862ac414a84c5d82ffa407d0.tar.gz |
Core: don't remove dive from trip in add_dive_to_trip()
All callers of add_dive_to_trip() work on freshly generated dives,
with one exception, that was redundant anyway. Therefore it is not
necessary to remove the dive from a potential previous trip. Move the
responsibility of removing the dive from a trip to the caller,
respectively remove the redundant call. Add a warning message in the
case that trip is set.
Background: On import (either download or file-import) we might not
want to add trips to the global trip-list. For example to enable undo
of import but more generally to detangle that data flow. Thus,
add_dive_to_trip() should not mingle with the global trip-list,
which it has to do if a trip is deleted because the old dive was
removed.
Analysis of the add_dive_to_trip() callers:
1) core/dive.c
pick_trip():
called on freshly generated merged dive.
finish_split():
called on two freshly generated split dives.
2) core/divelist.c
create_and_hookup_trip_from_dive():
called on freshly downloaded dive in dive_cb().
called on freshly downloaded dive in record_uemis_dive().
autogroup_dives():
called on dive from get_dives_to_autogroup(), which only
finds dives that are outside of trips.
combine_trips():
unused - removed in sibling commit.
try_to_merge_into():
this call was actually erroneous - dive was already added
to trip in try_to_merge(). Remove call.
3) core/libdivecomputer.c
dive_cb():
called on freshly downloaded dive.
4) core/uemis_downloader.c
record_uemis_dive():
called on freshly downloaded dive.
5) core/load_git.c
create_new_dive():
called on freshly allocated dive.
6) core/parse.c
dive_end():
called on freshly parsed dive.
7) desktop-widgets/command_divelist.cpp
DiveListBase::addDive():
called on dive which is newly added to core.
moveDiveToTrip():
called on dive that was removed from trip a few lines above.
8) mobile-widgets/qmlmanager.cpp
QMLManager::undoDelete():
called on dive where divetrip was reset in the previous line.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/compressibility.r')
0 files changed, 0 insertions, 0 deletions