From 55ffc0f27638485803f29d985a57deb5b3db4584 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 19 Mar 2010 17:34:30 +1000 Subject: Don't crash if an out of bounds model index is accessed. Task-number: QTBUG-9184 --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 6341764..b31bbd0 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -422,6 +422,8 @@ int QDeclarativeVisualDataModelDataMetaObject::createProperty(const char *name, return -1; QDeclarativeVisualDataModelPrivate *model = QDeclarativeVisualDataModelPrivate::get(data->m_model); + if (data->m_index < 0 || data->m_index >= model->modelCount()) + return -1; if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) { if (model->m_listAccessor->type() == QDeclarativeListAccessor::ListProperty) { -- cgit v0.12 From 62ca76e14166b8f4c16e7cd9c285d373e460ebf7 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 19 Mar 2010 17:39:11 +1000 Subject: Setting stacking order from top to bottom seems to work better. Task-number: QTBUG-9182 --- src/declarative/graphicsitems/qdeclarativerepeater.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index b9696c8..e8f9b24 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -358,14 +358,10 @@ void QDeclarativeRepeater::itemsMoved(int from, int to, int count) removed << d->deletables.takeAt(from); for (int i = 0; i < count; ++i) d->deletables.insert(to + i, removed.at(i)); - for (int i = 0; i < d->model->count(); ++i) { - if (i < from && i < to) - continue; - QDeclarativeItem *item = d->deletables.at(i); - if (i < d->deletables.count()-1) - item->stackBefore(d->deletables.at(i+1)); - else - item->stackBefore(this); + d->deletables.last()->stackBefore(this); + for (int i = d->model->count()-1; i > 0; --i) { + QDeclarativeItem *item = d->deletables.at(i-1); + item->stackBefore(d->deletables.at(i)); } } -- cgit v0.12 From b6e74016305ea70ed36a7eb1504d3120106dbb23 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 19 Mar 2010 19:50:29 +1000 Subject: Initialize variable. --- src/imports/particles/qdeclarativeparticles_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imports/particles/qdeclarativeparticles_p.h b/src/imports/particles/qdeclarativeparticles_p.h index 993796d..9035e3e 100644 --- a/src/imports/particles/qdeclarativeparticles_p.h +++ b/src/imports/particles/qdeclarativeparticles_p.h @@ -111,7 +111,7 @@ class QDeclarativeParticleMotionWander : public QDeclarativeParticleMotion Q_OBJECT public: QDeclarativeParticleMotionWander() - : QDeclarativeParticleMotion(), particles(0), _xvariance(0), _yvariance(0) {} + : QDeclarativeParticleMotion(), particles(0), _xvariance(0), _yvariance(0), _pace(100) {} virtual void advance(QDeclarativeParticle &, int interval); virtual void created(QDeclarativeParticle &); -- cgit v0.12