summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-05-05 11:24:11 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-05-05 12:02:46 (GMT)
commit0600097e58946f8af280349eebc01bc3415f0d61 (patch)
tree9178c394e3abefed5cef0b080c85d623dbbcd89f
parent8d96a5510cb433371a0e8686f20f1a39c0a286d3 (diff)
downloadQt-0600097e58946f8af280349eebc01bc3415f0d61.zip
Qt-0600097e58946f8af280349eebc01bc3415f0d61.tar.gz
Qt-0600097e58946f8af280349eebc01bc3415f0d61.tar.bz2
QListView in icon mode could crash when removing the last element
Task-number: 252292 Reviewed-by: ogoffart
-rw-r--r--src/gui/itemviews/qlistview.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 07f0a38..48f53a0 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1997,14 +1997,15 @@ bool QListViewPrivate::doItemsLayout(int delta)
int first = batchStartRow();
int last = qMin(first + delta - 1, max);
- if (max < 0 || last < first)
- return true; // nothing to do
-
if (first == 0) {
layoutChildren(); // make sure the viewport has the right size
prepareItemsLayout();
}
+ if (max < 0 || last < first) {
+ return true; // nothing to do
+ }
+
QListViewLayoutInfo info;
info.bounds = layoutBounds;
info.grid = gridSize();