[PyQt] [Regression] QSGGeometry crash with PyQt 5.5
Arjen Hiemstra
a.hiemstra at ultimaker.com
Mon Jul 27 13:25:37 BST 2015
So it took some fiddling, but I managed to reduce it to a fairly
simple test case, which is attached to this mail.
Along the way, I discovered a few things:
* If I never store the new paint node, geometry and material, I get a
crash as soon as the item should be rendered with PyQt 5.5. With PyQt
5.4 it just never shows up.
* If I create the new paint node as a function-local variable, then
just before returning store them as member variables, everything
works.
* If I create the paint node as member variable, the first time
updatePaintNode is called, everything works. As soon as I call
update() on the item however, things crash.
On 24 July 2015 at 17:57, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 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
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
--
IMAGINE IT >> MAKE IT
Meet us online at Twitter <http://twitter.com/ultimaker>, Facebook
<http://facebook.com/ultimaker>, Google+ <http://google.com/+Ultimaker>
www.ultimaker.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyqt_bug.py
Type: text/x-python
Size: 3380 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150727/0d756697/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyqt_bug.qml
Type: application/octet-stream
Size: 601 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150727/0d756697/attachment.obj>
More information about the PyQt
mailing list