From 786cea007678c3fa086a45392eb6745d54d6e7c4 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Thu, 4 Jul 2013 23:35:01 +0200 Subject: Make sure that KItemListSizeHintResolver is always consistent This was the root cause of bug 317827. The assert tried to make sure that we never access KItemListSizeHintResolver from KItemListViewLayouter inside the loop over the item ranges. This would be dangerous because it might be in an inconsistent state - the removed item ranges were removed step by step, so accessing the item size hints before the operation was finished could lead to wrong results. The solution is to insert/remove all item ranges immediately. A nice side effect is that there are no sources of O(N^2) complexity in KItemListSizeHintResolver any more if many item ranges are inserted/removed. BUG: 317827 FIXED-IN: 4.11.0 REVIEW: 111382 --- src/kitemviews/private/kitemlistsizehintresolver.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/kitemviews/private/kitemlistsizehintresolver.h') diff --git a/src/kitemviews/private/kitemlistsizehintresolver.h b/src/kitemviews/private/kitemlistsizehintresolver.h index 6f50d673c..5ec5f4a21 100644 --- a/src/kitemviews/private/kitemlistsizehintresolver.h +++ b/src/kitemviews/private/kitemlistsizehintresolver.h @@ -22,7 +22,7 @@ #include -#include +#include #include #include @@ -38,8 +38,8 @@ public: virtual ~KItemListSizeHintResolver(); QSizeF sizeHint(int index) const; - void itemsInserted(int index, int count); - void itemsRemoved(int index, int count); + void itemsInserted(const KItemRangeList& itemRanges); + void itemsRemoved(const KItemRangeList& itemRanges); void itemsMoved(int index, int count); void itemsChanged(int index, int count, const QSet& roles); -- cgit v1.3.1