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 <bisson@archlinux.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
7eda75d7ab
commit
ddfc384b61
@ -486,7 +486,7 @@ Qt::ItemFlags CylindersModel::flags(const QModelIndex &index) const
|
||||
return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
|
||||
}
|
||||
|
||||
void CylindersModel::remove(const QModelIndex &index)
|
||||
void CylindersModel::remove(QModelIndex index)
|
||||
{
|
||||
|
||||
if (index.column() == USE) {
|
||||
|
||||
@ -46,7 +46,7 @@ public:
|
||||
|
||||
public
|
||||
slots:
|
||||
void remove(const QModelIndex &index);
|
||||
void remove(QModelIndex index);
|
||||
void cylindersReset(const QVector<dive *> &dives);
|
||||
bool updateBestMixes();
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -31,7 +31,7 @@ public:
|
||||
|
||||
public
|
||||
slots:
|
||||
void remove(const QModelIndex &index);
|
||||
void remove(QModelIndex index);
|
||||
void weightsystemsReset(const QVector<dive *> &dives);
|
||||
|
||||
private:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user