From 76cab71b7c59b938d8999b1abb457182daea5959 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 27 Mar 2020 23:06:07 +0100 Subject: 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 --- commands/command_edit.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- cgit v1.2.3-70-g09d2