Comment 20 for bug 561303

Revision history for this message
Scott Kitterman (kitterman) wrote :

The full diff isn't needed and contains new features that aren't the sort we generally accept for an SRU. The relevant bit of the diff to fix this problem is:

=== modified file 'sip/QtGui/qapplication.sip'
--- sip/QtGui/qapplication.sip revid:<email address hidden>
+++ sip/QtGui/qapplication.sip revid:<email address hidden>
@@ -1,4 +1,4 @@
-// qapplication.sip generated by MetaSIP on Wed Mar 17 18:29:25 2010
+// qapplication.sip generated by MetaSIP on Fri Apr 16 11:32:08 2010
 //
 // This file is part of the QtGui Python extension module.
 //
@@ -596,13 +596,17 @@
 %End
     virtual ~QApplication();
 %MethodCode
- // Make sure all top level widgets are deleted before the QApplication. This
- // is a typical cause of crashes (or at least strange behaviour) when an
- // application terminates.
+ // Make sure all top level widgets are not owned by Python and so won't be
+ // destroyed by the garbage collector after QApplication is destroyed.
         QWidgetList tlw = QApplication::topLevelWidgets();

         for (int i = 0; i < tlw.count(); ++i)
- delete tlw.at(i);
+ {
+ PyObject *sw = sipGetPyObject(tlw.at(i), sipType_QWidget);
+
+ if (sw)
+ sipTransferTo(sw, 0);
+ }

         // Handle all other QObject instances that we want to make sure are deleted
         // before the QApplication is deleted.

Please don't do the full version update. Do a new one with this as a patch.