Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.2.0
-
None
-
Qt 5.2 from git stable branch
Linux (Ubuntu 12.10)
-
486d367e8086e63f51707e78c07ef77fa6240f0a
Description
Segfault occurs in the code below.
I am using Qt 5.2 stable from git.
int QSGOpaqueTextureMaterial::compare(const QSGMaterial *o) const { Q_ASSERT(o && type() == o->type()); const QSGOpaqueTextureMaterial *other = static_cast<const QSGOpaqueTextureMaterial *>(o); if (int diff = m_texture->textureId() - other->texture()->textureId()) return diff; return int(m_filtering) - int(other->m_filtering); }
on
if (int diff = m_texture->textureId() - other->texture()->textureId())
because other->texture() returns 0
I am not sure why this happens.
In my case it appears to happen when my QQuickImageProvider::requestPixmap returns a pixmap without alpha channel. For example:
QPixmap RoundedImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) { int width = 800; int height = 800; if (size) *size = QSize(width, height); QPixmap pixmap(requestedSize.width() > 0 ? requestedSize.width() : width, requestedSize.height() > 0 ? requestedSize.height() : height); pixmap.fill(Qt::red); // Draw on pixmap here return pixmap; }
might cause the segfault but if I replace Qt::red with Qt::transparent there is no segfault. There is also no segfault if I first fill with Qt::transparent and then with Qt::red (probably because the pixmap gets an alpha channel then)
Might be worth to check out what might actually go wrong? Perhaps other problems are triggered by the offending code.
Attachments
Issue Links
- is required for
-
QTBUG-33863 Issues to be fixed before Qt5.2 RC1 release
- Closed
For Gerrit Dashboard: QTBUG-34062 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
68191,2 | Prevent badly formed texture nodes in the scene graph. | stable | qt/qtdeclarative | Status: MERGED | +2 | 0 |