From ddfc384b61b5990a54a5b0613a39c3ffb4ac23f4 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 26 Nov 2019 23:41:56 +0100 Subject: Cylinders: Fix crash when removing cylinders Change the remove() function of the cylinder and weight models to take the index by value. The code used to take it by reference and the reference would be invalidated when removing rows from the model! Reported-by: Gaetan Bisson Signed-off-by: Berthold Stoeger --- qt-models/weightmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-models/weightmodel.cpp') diff --git a/qt-models/weightmodel.cpp b/qt-models/weightmodel.cpp index 3b5a122bf..36971f12e 100644 --- a/qt-models/weightmodel.cpp +++ b/qt-models/weightmodel.cpp @@ -21,7 +21,7 @@ weightsystem_t *WeightModel::weightSystemAt(const QModelIndex &index) return &displayed_dive.weightsystems.weightsystems[index.row()]; } -void WeightModel::remove(const QModelIndex &index) +void WeightModel::remove(QModelIndex index) { if (index.column() != REMOVE) return; -- cgit v1.2.3-70-g09d2