<div dir="ltr"><div><div>Hello, <br><br></div>I have an example that produces a crash on exit:<br><br><pre style="margin-left:40px" class=""><code><span class="">from</span><span class=""> </span><span class="">PyQt4</span><span class=""> </span><span class="">import</span><span class=""> </span><span class="">Qt</span><span class="">,</span><span class=""> </span><span class="">QtGui</span><span class="">,</span><span class=""> </span><span class="">QtCore</span><span class="">
</span><span class="">def</span><span class=""> main</span><span class="">()</span><span class=""> </span><span class="">:</span><span class="">
app </span><span class="">=</span><span class=""> </span><span class="">QtGui</span><span class="">.</span><span class="">QApplication</span><span class="">([])</span><span class="">
x </span><span class="">=</span><span class=""> </span><span class="">QtGui</span><span class="">.</span><span class="">QGraphicsView</span><span class="">()</span><span class="">
s </span><span class="">=</span><span class=""> </span><span class="">QtGui</span><span class="">.</span><span class="">QGraphicsScene</span><span class="">()</span><span class="">
x</span><span class="">.</span><span class="">setScene</span><span class="">(</span><span class="">s</span><span class="">)</span><span class="">
x</span><span class="">.</span><span class="">show</span><span class="">()</span><span class="">
app</span><span class="">.</span><span class="">exec_</span><span class="">()</span><span class="">
main</span><span class="">()</span></code></pre>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.<br><br>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..<br><br><br></div>Luke<br></div>