Undo: remember deleted trip in UndoRemoveDivesFromTrip::undo()

If the last dive of a trip is removed, the trip is deleted.
On redo the dive is added to a non existing trip, leading to a
segfault.

Therefore, keep a copy of the trip to reinstate it on redo.
Note: this cannot work for a sequence of multiple commands.
One would have to rewrite the whole undo-history. Nevertheless,
let's do this as a stop-gap measure.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-07-18 19:31:59 +02:00 committed by Lubomir I. Ivanov
parent b51e616b6a
commit 325b8bba35
4 changed files with 33 additions and 8 deletions

View file

@ -45,6 +45,7 @@ public:
private:
QMap<struct dive*, dive_trip*> divesToUndo;
QList<struct dive_trip*> tripList;
};
#endif // UNDOCOMMANDS_H