Avoid crash when texture changes.
authorPaul Olav Tvete <paul.tvete@nokia.com>
Mon, 18 Apr 2011 11:23:41 +0000 (13:23 +0200)
committerPaul Olav Tvete <paul.tvete@nokia.com>
Mon, 18 Apr 2011 11:26:01 +0000 (13:26 +0200)
Now that we delete and re-create the texture in surfaceDamaged(), we have
to tell the node about the texture each time, and not only at creation.

src/qt-compositor/compositor_api/waylandsurfaceitem.cpp

index 74602ff..02df7e9 100644 (file)
@@ -55,6 +55,7 @@ void WaylandSurfaceItem::surfaceDamaged(const QRect &)
         delete m_texture;
 
     if (m_surface->type() == WaylandSurface::Texture) {
+        //qDebug() << "createTextureFromId" << m_surface->texture() << m_surface->geometry().size();
         m_texture = canvas()->sceneGraphEngine()->createTextureFromId(m_surface->texture(),
                                                                       m_surface->geometry().size());
     } else {
@@ -180,8 +181,8 @@ QSGNode *WaylandSurfaceItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
 
     if (!node) {
         node = new QSGSimpleTextureNode();
-        node->setTexture(m_texture);
     }
+    node->setTexture(m_texture);
 
     node->setRect(QRectF(0, height(), width(), -height()));
     node->setFiltering(smooth() ? QSGTexture::Linear : QSGTexture::Nearest);