Fixed crash when Image/ShaderEffectSource source is missing.

This commit is contained in:
Kim Motoyoshi Kalland 2011-05-18 17:49:06 +02:00
parent 7ef7dd68dc
commit acbc84876a
2 changed files with 13 additions and 5 deletions

View 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;
}

View 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);