summaryrefslogtreecommitdiffstats
path: root/commands/command_edit.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-27 23:06:07 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-28 10:55:04 -0700
commit76cab71b7c59b938d8999b1abb457182daea5959 (patch)
treef710ff3ed036d0ae1817020e4f8119a840d92613 /commands/command_edit.cpp
parentfbf99c01055cae4e6df606c1cc5faad19d4bf2c5 (diff)
downloadsubsurface-76cab71b7c59b938d8999b1abb457182daea5959.tar.gz
mobile: fix filter flag when editing dives
When editing dives, the undo-command sends a filte changed signal. The models catch the signal and check whether the filter status changed. The mobile-version of the dive-edit command simply exchanged the dives. This could lead to inconsistencies when the filter flag was overwritten. Therefore, make sure that the filter flag is not overwritten by the dive-exchange. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_edit.cpp')
-rw-r--r--commands/command_edit.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp
index 218f3a2b8..194264531 100644
--- a/commands/command_edit.cpp
+++ b/commands/command_edit.cpp
@@ -1242,6 +1242,12 @@ void EditDive::redo()
void EditDive::exchangeDives()
{
+ // Set the filter flag of the new dive to the old dive.
+ // Reason: When we send the dive-changed signal, the model will
+ // track the *change* of the filter flag, so we must not overwrite
+ // it by swapping the dive data.
+ newDive->hidden_by_filter = oldDive->hidden_by_filter;
+
// Bluntly exchange dive data by shallow copy
std::swap(*newDive, *oldDive);
invalidate_dive_cache(oldDive);