diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-10-03 10:37:37 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-10-03 10:01:13 -0700 |
commit | cd22b86bf8cf6c5f521bc9244b4a21537b5fea44 (patch) | |
tree | 44e49876895f1f05d7fd75ca64539f49aae5d861 | |
parent | 00abc04913d8aef45be4e30f23d5ebc9914c8d54 (diff) | |
download | subsurface-cd22b86bf8cf6c5f521bc9244b4a21537b5fea44.tar.gz |
dive list: when moving dives, delete first and add later
When moving dives between trips, the core moves the dives internally
and sends a signal to the model. The model adds and removes the dives
accordingly. However, when adding the new dive, the old trip hasn't
changed its position, so the ordering is wrong leading to an inconsistent
state.
Therefore, remove the dives first and then readd them. There could
still be pathological cases where this fails. However, in the short
term this is an improvement. Note that in similar cases, the dives were
indeed removed then added, so this case here seems to be an oversight.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | qt-models/divetripmodel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 539cf98ff..bc2c2ea46 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -1325,8 +1325,8 @@ void DiveTripModelTree::divesMovedBetweenTrips(dive_trip *from, dive_trip *to, b // Cheating! // Unfortunately, removing the dives means that their selection is lost. // Thus, remember the selection and re-add it later. - divesAdded(to, createTo, dives); divesDeletedInternal(from, deleteFrom, dives); // Use internal version to keep current dive + divesAdded(to, createTo, dives); } void DiveTripModelTree::divesTimeChanged(timestamp_t delta, const QVector<dive *> &dives) |