[PyQt] Exit crash with QGraphicsScene

Luke Campagnola lcampagn at email.unc.edu
Thu Nov 27 00:14:15 GMT 2014


Hello,

I have an example that produces a crash on exit:

from PyQt4 import Qt, QtGui, QtCore
def main() :
    app = QtGui.QApplication([])
    x = QtGui.QGraphicsView()
    s = QtGui.QGraphicsScene()
    x.setScene(s)
    x.show()
    app.exec_()

main()

The basic issue seems to be that the QApplication is deleted before python
exits, and the QGraphicsScene is not given a parent and thus outlives the
QApplication.

I am wondering if this is a PyQt bug, or if falls into the category of
object lifetime / deletion issues that the user is responsible for? I do
not get the same behavior with PySide, so I assume it should be possible to
fix in PyQt as well..


Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20141126/33f17d72/attachment.html>


More information about the PyQt mailing list