From 5692f0d68aa1224cce7f2f25e66b8dd8663f2d66 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 11 Jan 2021 11:14:41 +0100 Subject: undo: add missing invalidate_dive_cache() calls The AddWeight, RemoveWeight, EditWeight and ReplanDive commands were missing invalidate_dive_cache() calls. Add them to ensure that the dives are written to git logs on save. Fixes #3150 Reported-by: Peter Zaal Signed-off-by: Berthold Stoeger --- commands/command_edit.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'commands') diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp index 62150ad9c..345ca0cfe 100644 --- a/commands/command_edit.cpp +++ b/commands/command_edit.cpp @@ -838,6 +838,7 @@ void ReplanDive::undo() std::swap(d->duration, duration); std::swap(d->salinity, salinity); fixup_dive(d); + invalidate_dive_cache(d); // Ensure that dive is written in git_save() QVector divesToNotify = { d }; // Note that we have to emit cylindersReset before divesChanged, because the divesChanged @@ -875,6 +876,7 @@ void AddWeight::undo() continue; remove_weightsystem(d, d->weightsystems.nr - 1); emit diveListNotifier.weightRemoved(d, d->weightsystems.nr); + invalidate_dive_cache(d); // Ensure that dive is written in git_save() } } @@ -883,6 +885,7 @@ void AddWeight::redo() for (dive *d: dives) { add_cloned_weightsystem(&d->weightsystems, empty_weightsystem); emit diveListNotifier.weightAdded(d, d->weightsystems.nr - 1); + invalidate_dive_cache(d); // Ensure that dive is written in git_save() } } @@ -954,6 +957,7 @@ void RemoveWeight::undo() for (size_t i = 0; i < dives.size(); ++i) { add_to_weightsystem_table(&dives[i]->weightsystems, indices[i], clone_weightsystem(ws)); emit diveListNotifier.weightAdded(dives[i], indices[i]); + invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save() } } @@ -962,6 +966,7 @@ void RemoveWeight::redo() for (size_t i = 0; i < dives.size(); ++i) { remove_weightsystem(dives[i], indices[i]); emit diveListNotifier.weightRemoved(dives[i], indices[i]); + invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save() } } @@ -1012,6 +1017,7 @@ void EditWeight::redo() for (size_t i = 0; i < dives.size(); ++i) { set_weightsystem(dives[i], indices[i], new_ws); emit diveListNotifier.weightEdited(dives[i], indices[i]); + invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save() } std::swap(ws, new_ws); } -- cgit v1.2.3-70-g09d2