[PyQt] Bug report: multiple QApplication instances cause a segfault

Algis Kabaila akabaila at pcug.org.au
Tue Jun 21 22:21:05 BST 2011


On Wed, 22 Jun 2011 02:04:25 AM David Townshend wrote:
> Hi
> 
> I'm not sure of the appropriate place to file a PyQt bug report, so I hope
> its ok to send it to this mailing list.
> 
> The problem is that creating (and quitting) multiple QApplications in
> succession causes a segfault.  This situation tends to occur in unit tests,
> particularly in testing subclasses of QApplication.
> 
> The following snippet illustrates the problem:
> >>> from PyQt4 import QtGui
> >>> app = QtGui.QApplication([])
> >>> app.quit()
> >>> app = QtGui.QApplication([])
> >>> app.quit()
> >>> app = QtGui.QApplication([])
> 
> Segmentation fault
> 
> Here is my python info:
> Python 3.2 (r32:88445, Apr 15 2011, 11:09:05)
> [GCC 4.5.2 20110127 (prerelease)] on linux2
> 
> I'm using PyQt 4.8.4 on Arch Linux.  I have tried it on Windows XP, but the
> segfault does not occur there.  I haven't tried other linux distributions.
> 
> David

David,

There is a bug tracker for bug reports where the bugs should be reported. I do 
not remember its URL, however.

On my  kubuntu "natty" OS  the results are somewhat different:

Using GUI Bash Shell: 

ak at supremo:~$ python3
Python 3.2 (r32:88445, Mar 25 2011, 19:56:22) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtGui
>>> app = QtGui.QApplication([])
>>> app.quit()
>>> app = QtGui.QApplication([])
>>> app.quit()
>>> app = QtGui.QApplication([])
>>> app.quit()
>>> app = QtGui.QApplication([])
>>> app.quit()
>>> app = QtGui.QApplication([])
>>> app.quit()
>>>   [---> ctrl+D pressed to quit python3.2] 
Segmentation fault
ak at supremo:~$ 

Segmentation fault occured when quitting Python3.2, not when repeatedly 
creating and quitting app.

Using IDLE things go strange sooner:

Python 3.2 (r32:88445, Mar 25 2011, 19:56:22) 
[GCC 4.5.2] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>> from PyQt4 import QtGui
>>> app = QtGui.QApplication([])
>>> app.quit()
>>> app = QtGui.QApplication([])
>>> app.quit()

Python 3.2 IDLE shell vanishes from the screen without warning. No <Return> 
pressed after typing app.quit() !

My Linux OS:
ak at supremo:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 11.04
Release:        11.04
Codename:       natty
ak at supremo:~$ 

PyQt4 and Qt versions:

Python 3.2 (r32:88445, Mar 25 2011, 19:56:22) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtCore import (PYQT_VERSION_STR, QT_VERSION_STR)
>>> PYQT_VERSION_STR
'4.8.4'
>>> QT_VERSION_STR
'4.7.2'
>>> 

I've encountered similar problems in PySide.  I think it was considered to be 
a Python IDLE fault.  I know it does not shed much light on your problem, only 
some additional information.

OldAl.


More information about the PyQt mailing list