[PyQt] segfault with latest release

Hans-Peter Jansen hpj at urpla.net
Thu Dec 30 21:40:52 GMT 2010


On Thursday 30 December 2010, 18:18:22 Martin Airs wrote:
> On Thursday 30 Dec 2010 14:40:59 Erik Janssens wrote:
> > Hi,
> >
> > just got a stacktrace of a segfault under Linux.
> >
> > any suggestions of what I should be looking for ?

Erik, could you be a bit more verbose on the context, this is happening.

> > Thx,
> >
> > Erik
>
> I get a segfault when running the qtdemo, however if i run it with
> -software as apposed to -opengl it runs ok.
>
> I dont know, but are you using opengl in your app, can you run the
> qtdemo?

Hmm, not here:

python: 2.6
sip: 4.12.1-snapshot-1da2e2e9fa1c
qt4: 4.7.1
pyqt4: snapshot-4.8.3-1d2c3e10879e

Phil, qtdemo.py has an issue when using -use-window-mask:


/usr/share/doc/packages/python-qt4-devel/examples/demos/qtdemo> ./qtdemo.py -use-window-mask
Traceback (most recent call last):
  File "./qtdemo.py", line 88, in <module>
    mainWindow.enableMask(True)
  
File "/usr/share/doc/packages/python-qt4-devel/examples/demos/qtdemo/mainwindow.py", 
line 158, in enableMask
    self.setMask(QtCore.QRegion(region))
AttributeError: 'module' object has no attribute 'QRegion'

QRegion is in QtGui. Fix attached (first hunk).

The other hunks try to address Qt spewing this on exit:

QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.

The "solution" isn't nice, either.. I've tried to solve this within the 
GL context, but that attempt resulted in:

Traceback (most recent call last):
  
File "/usr/share/doc/packages/python-qt4-devel/examples/demos/qtdemo/mainwindow.py", 
line 330, in keyPressEvent
    self.quit()
  
File "/usr/share/doc/packages/python-qt4-devel/examples/demos/qtdemo/mainwindow.py", 
line 433, in stop
    viewport.context().setInitialized(False)
RuntimeError: no access to protected functions or signals for objects 
not created from Python

I don't know, if this would solve the issue in question, though.

With my patch, all three methods to quit the app (by escape key, WM quit 
and Quit button) don't make Qt spew at least.

Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyqtdemo.diff
Type: text/x-diff
Size: 1655 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101230/09e5f317/attachment-0001.diff>


More information about the PyQt mailing list