-
Bug
-
Resolution: Done
-
P1: Critical
-
4.7.1
-
None
-
Windows Vista, Kubuntu linux
-
cb470a33bf85cf15b9df57e3ade27c6a0720d138
OpenGL paint engine crahses whenever QPainterPath's first element is not MoveElement. This can be achieved by using connectPath on PainterPath which contains only moveTo element.
/////////////////////////////////////////
Following example will clear the problem:
QPainterPath path1;
QPainterPath path2;
QPainterPath path3;
QPainterPath path4;
path1.moveTo(1,1);
path2.moveTo(4,4);
path2.lineTo(5,6);
path2.lineTo(6,7);
path3.connectPath(path2);
path4.lineTo(5,5);
path1.connectPath(path2);
qDebug() << path1;
qDebug() << path2;
qDebug() << path3;
qDebug() << path4;
////////////////////////////////////
The result is:
QPainterPath: Element count=3
-> LineTo(x=4, y=4)
-> LineTo(x=5, y=6)
-> LineTo(x=6, y=7)
QPainterPath: Element count=3
-> MoveTo(x=4, y=4)
-> LineTo(x=5, y=6)
-> LineTo(x=6, y=7)
QPainterPath: Element count=3
-> LineTo(x=4, y=4)
-> LineTo(x=5, y=6)
-> LineTo(x=6, y=7)
QPainterPath: Element count=2
-> MoveTo(x=0, y=0)
-> LineTo(x=5, y=5)
//////////////////////////////////////
As you may notice path1 and path3 are incorrect, since they don't have moveToElement as the first element in the path.
Using QPainter::drawPath(const QPainterPath & path) from paintEvent implemented in custom QGraphicsItem, while the view's viewport is a QGLWidget, will crash the application.
Q_ASSERT(m_elements.first().type == QPainterPath::MoveToElement); in void QStroker::processCurrentSubpath()