[PyQt] Segmentation fault sharing GL context

David Hoese dhoese at gmail.com
Tue Mar 12 18:35:10 GMT 2019


Hi,

I'm one of the maintainers of the vispy library 
(https://github.com/vispy/vispy). It's a high level wrapper around 
OpenGL and we offer PyQt5 as one of the backends people can use to 
create a GL canvas. Recently we merged changes to use PyQt5's newer 
QOpenGLWidget interface instead of QGLWidget.

While working on these changes we kept getting inconsistent results and 
segmentation faults in places where multiple QOpenGLWidgets were 
created. We tracked it down to context sharing being the problem and 
have disabled it for now. We were enabling it by default by setting 
"Qt::AA_ShareOpenGLContexts" on the QApplication 
(https://doc.qt.io/qt-5/qopenglwidget.html#context-sharing).

We and a lot of our users use conda with the conda-forge channel to 
install PyQt, but due to some compilation limitations they are limited 
to PyQt 5.6. I'm wondering if anyone is aware of fixes in more recent 
versions of PyQt that may fix some of the issues we've run in to? If 
not, does anyone know the proper way to unlink contexts/widgets from the 
QApplication? I think what is happening is that one canvas is getting 
garbage collected by python and another is being created, but the 
QApplication is still trying to use the gc'd objects.

Thanks.

Dave

P.S. Please CC me in any replies. I only get a digest of this mailing 
list right now.


More information about the PyQt mailing list