[PyQt] [Regression] QSGGeometry crash with PyQt 5.5
Phil Thompson
phil at riverbankcomputing.com
Fri Jul 24 16:57:16 BST 2015
On 24/07/2015 4:45 pm, Arjen Hiemstra wrote:
> Hi,
>
> Using PyQt 5.4 the following code (from a custom QQuickItem) works:
>
> def updatePaintNode(self, paint_node, update_data):
> self._node = QSGGeometryNode()
>
> self._geometry =
> QSGGeometry(QSGGeometry.defaultAttributes_Point2D(), 6, 12)
> self._geometry.setDrawingMode(0x0004)
>
> self._geometry.vertexDataAsPoint2D()[0].set(self._corner_size, 0)
> self._geometry.vertexDataAsPoint2D()[1].set(0,
> self._corner_size)
> self._geometry.vertexDataAsPoint2D()[2].set(0,
> self.height())
> self._geometry.vertexDataAsPoint2D()[3].set(self.width() -
> self._corner_size, self.height())
> self._geometry.vertexDataAsPoint2D()[4].set(self.width(),
> self.height() - self._corner_size)
> self._geometry.vertexDataAsPoint2D()[5].set(self.width(),
> 0)
>
> self._geometry.indexDataAsUShort()[0] = 0
> self._geometry.indexDataAsUShort()[1] = 1
> self._geometry.indexDataAsUShort()[2] = 2
>
> self._geometry.indexDataAsUShort()[3] = 0
> self._geometry.indexDataAsUShort()[4] = 2
> self._geometry.indexDataAsUShort()[5] = 3
>
> self._geometry.indexDataAsUShort()[6] = 0
> self._geometry.indexDataAsUShort()[7] = 3
> self._geometry.indexDataAsUShort()[8] = 4
>
> self._geometry.indexDataAsUShort()[9] = 0
> self._geometry.indexDataAsUShort()[10] = 4
> self._geometry.indexDataAsUShort()[11] = 5
>
> self._node.setGeometry(self._geometry)
>
> self._material = QSGFlatColorMaterial()
> self._material.setColor(self._color)
>
> self._node.setMaterial(self._material)
>
> return self._node
>
> Using PyQt5.5 the same code crashes. As far as I can tell, this is a
> regression from PyQt5.4, unless I am doing something terribly wrong.
>
> With some testing, it seems something is going wrong with
> QSGGeometry.defaultAttributes_Point2D() since removing that call and
> passing None to the QSGGeometry constructor will make things work (but
> no custom geometry shows up of course).
>
> Please let me know if you need any additional information.
Have you got a short, complete script I can run the reproduce the
problem?
Phil
More information about the PyQt
mailing list