aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickspriteengine.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2012-05-01 15:17:16 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-11 04:47:41 +0200
commit9c14462bad6c83e85db8960d0f48b42b198189a6 (patch)
tree8c0bc81910d94f7cd1363bfdc7da5c13788fb8f1 /src/quick/items/qquickspriteengine.cpp
parentbcc0e8801e7dee3c654e9dba650f789922e52491 (diff)
Keep m_states and m_sprites synchronized
Previously you could have more states than sprites, which could lead to errors because the sprite engine assumes bounds checking was done by the state engine (which only knows the size of the states list). Change-Id: Ie6069caa96d01cc28cc79350e6db5ff4191831a8 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickspriteengine.cpp')
-rw-r--r--src/quick/items/qquickspriteengine.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp
index e6aec066bc..60d6eddb3d 100644
--- a/src/quick/items/qquickspriteengine.cpp
+++ b/src/quick/items/qquickspriteengine.cpp
@@ -341,13 +341,20 @@ void QQuickSpriteEngine::startAssemblingImage()
return;
//This could also trigger the start of the image loading in Sprites, however that currently happens in Sprite::setSource
+
+ QList<QQuickStochasticState*> removals;
+
foreach (QQuickStochasticState* s, m_states){
QQuickSprite* sprite = qobject_cast<QQuickSprite*>(s);
- if (sprite)
+ if (sprite) {
m_sprites << sprite;
- else
+ } else {
+ removals << s;
qDebug() << "Error: Non-sprite in QQuickSpriteEngine";
+ }
}
+ foreach (QQuickStochasticState* s, removals)
+ m_states.removeAll(s);
m_startedImageAssembly = true;
}