Make QSGItem::update() work when called from inside QSGCanvasPlainRenderLoop::paint()
authorPaul Olav Tvete <paul.tvete@nokia.com>
Fri, 9 Sep 2011 13:03:01 +0000 (15:03 +0200)
committerSamuel Rødal <samuel.rodal@nokia.com>
Fri, 9 Sep 2011 13:56:44 +0000 (15:56 +0200)
If update was called in a function triggered by rendering, it would set
the dirty flag without posting an update event. Subsequent render calls
would just return without doing anything because the dirty flag was set.
This could cause the applications UI to freeze up.

Change-Id: Ib50403c1d9e22cc4680379f0c90fb2fcaa29c1d6
Reviewed-on: http://codereview.qt-project.org/4550
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>

src/declarative/items/qsgcanvas.cpp

index b89a642..2f66368 100644 (file)
@@ -91,6 +91,7 @@ public:
     }
 
     virtual void paint() {
+        updatePending = false;
         if (animationRunning && animationDriver())
             animationDriver()->advance();
         polishItems();
@@ -99,7 +100,6 @@ public:
         glViewport(0, 0, size.width(), size.height());
         renderSceneGraph(size);
         swapBuffers();
-        updatePending = false;
 
         if (animationRunning)
             maybeUpdate();