diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-04-27 01:07:46 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-04-27 01:07:46 (GMT) |
commit | e68c90aa37da6f0eb97f658e58dbb384325cdad2 (patch) | |
tree | 34797968ca4aaf6ef4c7bcca7d39a88fdcc2881a /src | |
parent | f341a9ef26e462d69c7cc7063efa433a77ce63c2 (diff) | |
download | Qt-e68c90aa37da6f0eb97f658e58dbb384325cdad2.zip Qt-e68c90aa37da6f0eb97f658e58dbb384325cdad2.tar.gz Qt-e68c90aa37da6f0eb97f658e58dbb384325cdad2.tar.bz2 |
Don't crash on invalid model remove signal.
Task-number: QTBUG-10209
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativerepeater.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 95f6276..d49bb02 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -346,21 +346,26 @@ void QDeclarativeRepeater::itemsInserted(int index, int count) void QDeclarativeRepeater::itemsRemoved(int index, int count) { Q_D(QDeclarativeRepeater); - if (!isComponentComplete()) + if (!isComponentComplete() || count <= 0) return; while (count--) { QDeclarativeItem *item = d->deletables.takeAt(index); - if (item) { + if (item) d->model->release(item); - } + else + break; } } void QDeclarativeRepeater::itemsMoved(int from, int to, int count) { Q_D(QDeclarativeRepeater); - if (!isComponentComplete()) + if (!isComponentComplete() || count <= 0) return; + if (from + count > d->deletables.count()) { + regenerate(); + return; + } QList<QDeclarativeItem*> removed; int removedCount = count; while (removedCount--) |