From 8bd16a7808d55b8d97c31571de503c23d621c3db Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 1 Jul 2014 10:18:21 -0700 Subject: Equipment edit: for some reason we need a local copy of index Calling enableEdition appears to corrupt the index that is passed into this slot. This doesn't fix the problem that we can't edit the cylinder start and end pressure of a manually added dive, but at least we no longer try to edit and invalid index. See #582 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'qt-ui/maintab.cpp') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 90a527e3a..e5c2830fc 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1083,14 +1083,16 @@ void MainTab::on_visibility_valueChanged(int value) void MainTab::editCylinderWidget(const QModelIndex &index) { + // we need a local copy or bad things happen when enableEdition() is called + QModelIndex editIndex = index; if (cylindersModel->changed && editMode == NONE) { enableEdition(); return; } - if (index.isValid() && index.column() != CylindersModel::REMOVE) { + if (editIndex.isValid() && editIndex.column() != CylindersModel::REMOVE) { if (editMode == NONE) enableEdition(); - ui.cylinders->edit(index); + ui.cylinders->edit(editIndex); } } -- cgit v1.2.3-70-g09d2