[PATCH] Divelist: fix a crash when updating the preferences
Lubomir I. Ivanov
neolit123 at gmail.com
Wed Dec 4 08:20:33 UTC 2013
From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
Hitting apply in the preferences dialog causes a QList assert.
This led to DiveListView::reloadHeaderActions(), where
we have an out of range access.
Patch makes the column count match the header action count.
Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
not sure how no one has caught this bug, perhaps the assert only triggers on
win32. i've CCed the original author for comments, since i don't think
i understand why we need to skip the first element?
git blame divelistview.cpp -L 397,397
4b0c053e (Helio Chissini de Castro 2013-06-09 20:09:39 -0300 397)
---
qt-ui/divelistview.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 27027c8..dc1420f 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -391,10 +391,9 @@ void DiveListView::reloadHeaderActions()
}
s.endGroup();
} else {
- // Skip first QAction item ( static text Visible )
for(int i = 0; i < model()->columnCount(); i++) {
QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString());
- header()->actions()[i+1]->setText( title );
+ header()->actions()[i]->setText(title);
}
}
}
--
1.7.11.msysgit.0
More information about the subsurface
mailing list