Fixed crash when Image/ShaderEffectSource source is missing.
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>
Wed, 18 May 2011 15:49:06 +0000 (17:49 +0200)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>
Wed, 18 May 2011 15:49:06 +0000 (17:49 +0200)
src/declarative/items/qsgimage.cpp
src/declarative/items/qsgshadereffectsource.cpp

index 10670f4..d280ef0 100644 (file)
@@ -179,10 +179,12 @@ QSGTexture *QSGImage::texture() const
 {
     Q_D(const QSGImage);
     QSGTexture *t = d->pix.texture();
-    t->setFiltering(QSGItemPrivate::get(this)->smooth ? QSGTexture::Linear : QSGTexture::Nearest);
-    t->setMipmapFiltering(QSGTexture::None);
-    t->setHorizontalWrapMode(QSGTexture::ClampToEdge);
-    t->setVerticalWrapMode(QSGTexture::ClampToEdge);
+    if (t) {
+        t->setFiltering(QSGItemPrivate::get(this)->smooth ? QSGTexture::Linear : QSGTexture::Nearest);
+        t->setMipmapFiltering(QSGTexture::None);
+        t->setHorizontalWrapMode(QSGTexture::ClampToEdge);
+        t->setVerticalWrapMode(QSGTexture::ClampToEdge);
+    }
     return t;
 }
 
index 199a560..217b0e6 100644 (file)
@@ -206,7 +206,13 @@ void QSGShaderEffectTexture::markDirtyTexture()
 
 void QSGShaderEffectTexture::grab()
 {
-    Q_ASSERT(m_item);
+    if (!m_item || m_size.isNull()) {
+        delete m_fbo;
+        delete m_secondaryFbo;
+        m_fbo = m_secondaryFbo = 0;
+        m_dirtyTexture = false;
+        return;
+    }
     QSGNode *root = m_item;
     while (root->childCount() && root->type() != QSGNode::RootNodeType)
         root = root->childAtIndex(0);