summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-04-07 11:44:20 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-04-07 12:21:02 (GMT)
commit2883580a3e10df16789ba1c9ee67507e508b95c1 (patch)
tree73b1986c6287e0d5d1aebe6047c467de29ade964 /src/gui
parent7be934e98dd75d2c8902df4e88e2a1aceab9789f (diff)
downloadQt-2883580a3e10df16789ba1c9ee67507e508b95c1.zip
Qt-2883580a3e10df16789ba1c9ee67507e508b95c1.tar.gz
Qt-2883580a3e10df16789ba1c9ee67507e508b95c1.tar.bz2
QTableView: fix spans corruption when removing spans.
- We should not do -1 after erasing, as it is done later on. - We should consider the 0 height even if it is not the last span. - Added an assert. Task-number: QTBUG-9631 Reviewed-by: Gabriel
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/itemviews/qtableview.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index c824a8a..c4d1317 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -114,15 +114,14 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height)
}
} else if (old_height > span->height()) {
//remove the span from all the subspans lists that intersect the columns not covered anymore
- Index::iterator it_y = index.lowerBound(-span->bottom());
- if (it_y == index.end())
- it_y = index.find(-span->top()); // This is the only span remaining and we are deleting it.
+ Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 0
Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list
while (-it_y.key() <= span->top() + old_height -1) {
if (-it_y.key() > span->bottom()) {
- (*it_y).remove(-span->left());
+ int removed = (*it_y).remove(-span->left());
+ Q_ASSERT(removed == 1); Q_UNUSED(removed);
if (it_y->isEmpty()) {
- it_y = index.erase(it_y) - 1;
+ it_y = index.erase(it_y);
}
}
if(it_y == index.begin())