Em 08/05/2014 01:52, "Thiago Macieira" <thi...@macieira.org> escreveu: > > 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 pointer0
I thought a constant reference keeped the object alive until the end of the life of the cost ref. > Signed-off-by: Thiago Macieira <thi...@macieira.org> > --- > qt-ui/divelistview.cpp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp > index 8c1c6a3..00906c6 100644 > --- a/qt-ui/divelistview.cpp > +++ b/qt-ui/divelistview.cpp > @@ -275,7 +275,7 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection) > connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), > this, SLOT(currentChanged(QModelIndex, QModelIndex))); > 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()) > scrollTo(idx.parent()); > scrollTo(idx); > -- > 1.8.4.5 > > _______________________________________________ > subsurface mailing list > subsurface@hohndel.org > http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
_______________________________________________ subsurface mailing list subsurface@hohndel.org http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface