From: Alan Alpert Date: Tue, 1 May 2012 05:17:16 +0000 (+1000) Subject: Keep m_states and m_sprites synchronized X-Git-Tag: upstream/5.2.1~1910 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c14462bad6c83e85db8960d0f48b42b198189a6;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index e6aec06..60d6edd 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 removals; + foreach (QQuickStochasticState* s, m_states){ QQuickSprite* sprite = qobject_cast(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; }