[PyQt] [Regression] QSGGeometry crash with PyQt 5.5
Arjen Hiemstra
a.hiemstra at ultimaker.com
Fri Jul 24 16:45:40 BST 2015
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.
The actual backtrace I get is as follows:
Thread 1 (Thread 0x7ffff7fc0700 (LWP 5257)):
#0 0x00007fffe53f2ddc in ?? () from /usr/lib/libQt5Quick.so.5
#1 0x00007fffe53f4524 in
QSGBatchRenderer::Renderer::prepareOpaqueBatches() () from
/usr/lib/libQt5Quick.so.5
#2 0x00007fffe5401108 in QSGBatchRenderer::Renderer::render() () from
/usr/lib/libQt5Quick.so.5
#3 0x00007fffe540c69f in QSGRenderer::renderScene(QSGBindable const&)
() from /usr/lib/libQt5Quick.so.5
#4 0x00007fffe540ceeb in QSGRenderer::renderScene(unsigned int) ()
from /usr/lib/libQt5Quick.so.5
#5 0x00007fffe541d2de in
QSGRenderContext::renderNextFrame(QSGRenderer*, unsigned int) () from
/usr/lib/libQt5Quick.so.5
#6 0x00007fffe546720b in QQuickWindowPrivate::renderSceneGraph(QSize
const&) () from /usr/lib/libQt5Quick.so.5
#7 0x00007fffe5437bcb in ?? () from /usr/lib/libQt5Quick.so.5
#8 0x00007fffe5438cd1 in ?? () from /usr/lib/libQt5Quick.so.5
#9 0x00007fffee90800c in QApplicationPrivate::notify_helper(QObject*,
QEvent*) () from /usr/lib/libQt5Widgets.so.5
#10 0x00007fffee90d4e6 in QApplication::notify(QObject*, QEvent*) ()
from /usr/lib/libQt5Widgets.so.5
#11 0x00007fffef3d5f4e in ?? () from
/usr/lib/python3.4/site-packages/PyQt5/QtWidgets.so
#12 0x00007ffff56be89b in QCoreApplication::notifyInternal(QObject*,
QEvent*) () from /usr/lib/libQt5Core.so.5
#13 0x00007ffff571405d in QTimerInfoList::activateTimers() () from
/usr/lib/libQt5Core.so.5
#14 0x00007ffff5714561 in ?? () from /usr/lib/libQt5Core.so.5
#15 0x00007ffff41689fd in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#16 0x00007ffff4168ce0 in ?? () from /usr/lib/libglib-2.0.so.0
#17 0x00007ffff4168d8c in g_main_context_iteration () from
/usr/lib/libglib-2.0.so.0
#18 0x00007ffff571523f in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
() from /usr/lib/libQt5Core.so.5
#19 0x00007ffff56bc26a in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
/usr/lib/libQt5Core.so.5
#20 0x00007ffff56c420c in QCoreApplication::exec() () from
/usr/lib/libQt5Core.so.5
#21 0x00007fffef3d4b0b in ?? () from
/usr/lib/python3.4/site-packages/PyQt5/QtWidgets.so
#22 0x00007ffff7a5df73 in call_function (oparg=<optimized out>,
pp_stack=0x7fffffffd800) at Python/ceval.c:4237
#23 PyEval_EvalFrameEx (f=f at entry=0x555556d8d1f8,
throwflag=throwflag at entry=0) at Python/ceval.c:2838
#24 0x00007ffff7a5dc09 in fast_function (nk=<optimized out>, na=1,
n=1, pp_stack=0x7fffffffd920, func=<optimized out>) at
Python/ceval.c:4334
#25 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd920) at
Python/ceval.c:4262
#26 PyEval_EvalFrameEx (f=0x7ffff6be2438, throwflag=<optimized out>)
at Python/ceval.c:2838
#27 0x00007ffff7a5e947 in PyEval_EvalCodeEx (_co=0x55555ad1baa0,
_co at entry=0x7ffff6ba5390, globals=0x0, globals at entry=0x7ffff6bdf3c8,
locals=0x555570e197f6,
locals at entry=0x7ffff6bdf3c8, args=0x0, argcount=502916598,
argcount at entry=0, kws=0x5555, kws at entry=0x0, kwcount=-155561072,
defs=0x0, defcount=0, kwdefs=0x0, closure=0x0)
at Python/ceval.c:3588
#28 0x00007ffff7a5e9eb in PyEval_EvalCode (co=co at entry=0x7ffff6ba5390,
globals=globals at entry=0x7ffff6bdf3c8,
locals=locals at entry=0x7ffff6bdf3c8) at Python/ceval.c:775
#29 0x00007ffff7a7a7d4 in run_mod (mod=mod at entry=0x5555557cb420,
filename=filename at entry=0x7ffff6b1e130,
globals=globals at entry=0x7ffff6bdf3c8,
locals=locals at entry=0x7ffff6bdf3c8,
flags=flags at entry=0x7fffffffdbb0, arena=arena at entry=0x5555558360e0)
at Python/pythonrun.c:2180
#30 0x00007ffff7a7c945 in PyRun_FileExFlags (fp=0x5555558346f0,
filename_str=<optimized out>, start=<optimized out>,
globals=0x7ffff6bdf3c8, locals=0x7ffff6bdf3c8, closeit=1,
flags=0x7fffffffdbb0) at Python/pythonrun.c:2133
#31 0x00007ffff7a7d923 in PyRun_SimpleFileExFlags (fp=0x55555ad1baa0,
filename=0x7ffff6bd68c0 "./cura_app.py", closeit=1, flags=0x5ad184e0)
at Python/pythonrun.c:1606
#32 0x00007ffff7a93aac in run_file (p_cf=<optimized out>,
filename=<optimized out>, fp=<optimized out>) at Modules/main.c:319
#33 Py_Main (argc=-156114896, argv=0x7ffff6bd68a0) at Modules/main.c:751
#34 0x0000555555554c06 in main ()
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.
- Arjen
--
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
More information about the PyQt
mailing list