mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-08 04:56:16 +00:00
Fix crash on dereferencing dangling pointers
QList::first() returns a reference to an item, but that list was a temporary. The list gets destroyed at the end of the statement (the semi-colon), so we ended up keeping a reference to freed data (i.e., a dangling pointer) Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5bd6361f91
commit
497d6e3e6c
1 changed files with 1 additions and 1 deletions
|
@ -275,7 +275,7 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection)
|
||||||
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
||||||
this, SLOT(currentChanged(QModelIndex, QModelIndex)));
|
this, SLOT(currentChanged(QModelIndex, QModelIndex)));
|
||||||
Q_EMIT currentDiveChanged(selected_dive);
|
Q_EMIT currentDiveChanged(selected_dive);
|
||||||
const QModelIndex &idx = m->match(m->index(0, 0), DiveTripModel::DIVE_IDX, selected_dive, 2, Qt::MatchRecursive).first();
|
QModelIndex idx = m->match(m->index(0, 0), DiveTripModel::DIVE_IDX, selected_dive, 2, Qt::MatchRecursive).first();
|
||||||
if (idx.parent().isValid())
|
if (idx.parent().isValid())
|
||||||
scrollTo(idx.parent());
|
scrollTo(idx.parent());
|
||||||
scrollTo(idx);
|
scrollTo(idx);
|
||||||
|
|
Loading…
Add table
Reference in a new issue