Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.1.0 Beta 1
-
None
-
Ubuntu 12.04 64-bit
-
493dea89672a8b4e4e1e3149283e93c0bfbe261c
Description
When ShaderEffectSource or DropShadow (from QtGraphicalEffects) have their width and height set to values of -1 or less, an assertion failure occurs. I encountered this with code similar to the sample below, which sets the size of the Canvas to negative values; which Canvas can cope with, but ShaderEffectSource and DropShadow both cause crashes.
An easier way to demonstrate the issue is just to directly set the width and height to negative values.
import QtQuick 2.0 import QtGraphicalEffects 1.0 Rectangle { width: 480; height: 300; Canvas { id: canvas anchors.centerIn: parent // width: -5 // height: -5 width: parent.width - arcLineWidth * 2 height: parent.height - arcLineWidth * 2 property real radius: Math.min(width, height) / 2 - arcLineWidth property real arcLineWidth: 10 onPaint: { var ctx = getContext("2d"); ctx.reset(); ctx.beginPath(); ctx.arc(width / 2, height / 2, radius, 0, Math.PI, false); ctx.closePath(); var gradient = ctx.createLinearGradient(0, 0, 0, radius * 2); gradient.addColorStop(0, "#ff0000"); gradient.addColorStop(1, "#ffaaaa"); ctx.lineWidth = arcLineWidth; ctx.strokeStyle = gradient; ctx.stroke(); } } ShaderEffectSource { id: canvasSource sourceItem: canvas anchors.fill: sourceItem // width: -5 // height: -5 hideSource: true } DropShadow { source: canvas anchors.fill: source // width: -5 // height: -5 radius: 8 samples: 16 } }
qtdeclarative/src/quick/scenegraph/qsgdefaultimagenode.cpp:
void QSGDefaultImageNode::updateGeometry() { Q_ASSERT(!m_targetRect.isEmpty()); const QSGTexture *t = m_material.texture(); if (!t) {
0 __GI_raise raise.c 64 0x7ffff4edd425 1 __GI_abort abort.c 91 0x7ffff4ee0b8b 2 qt_message_fatal qlogging.cpp 944 0x7ffff58fd11b 3 QMessageLogger::fatal qlogging.cpp 360 0x7ffff58fad8e 4 qt_assert qglobal.cpp 1992 0x7ffff58f665c 5 QSGDefaultImageNode::updateGeometry qsgdefaultimagenode.cpp 392 0x7ffff78c9197 6 QSGDefaultImageNode::update qsgdefaultimagenode.cpp 347 0x7ffff78c8f3c 7 QQuickShaderEffectSource::updatePaintNode qquickshadereffectsource.cpp 1025 0x7ffff7a150e2 8 QQuickWindowPrivate::updateDirtyNode qquickwindow.cpp 2432 0x7ffff790d00f 9 QQuickWindowPrivate::updateDirtyNodes qquickwindow.cpp 2253 0x7ffff790bf73 10 QQuickWindowPrivate::syncSceneGraph qquickwindow.cpp 300 0x7ffff7904345 11 QSGRenderThread::sync qsgthreadedrenderloop.cpp 530 0x7ffff78d9da3 12 QSGRenderThread::syncAndRender qsgthreadedrenderloop.cpp 569 0x7ffff78d9f2b 13 QSGRenderThread::run qsgthreadedrenderloop.cpp 664 0x7ffff78da460 14 QThreadPrivate::start qthread_unix.cpp 339 0x7ffff590f4d1 15 start_thread pthread_create.c 308 0x7ffff3c8fe9a 16 clone clone.S 112 0x7ffff4f9acbd 17 ??