[PyQt] Exit crash with QGraphicsScene
Phil Thompson
phil at riverbankcomputing.com
Thu Nov 27 10:15:54 GMT 2014
On 27/11/2014 12:14 am, Luke Campagnola wrote:
> 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..
See...
http://pyqt.sourceforge.net/Docs/PyQt5/pyqt4_differences.html#object-destruction-on-exit
Phil
More information about the PyQt
mailing list