diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-10-04 16:15:25 -0300 |
---|---|---|
committer | renatofilho <renato.filho@openbossa.org> | 2010-10-04 17:10:30 -0300 |
commit | 73fea931819ee1f6a32c50c9d67a9c292e69d45a (patch) | |
tree | 35b4ef441d9c343dbc27bf9a88e2e8339f19416f | |
parent | 2f8381e71213a1ecaed3ceda9ed9cdd981b79893 (diff) | |
download | pyside-73fea931819ee1f6a32c50c9d67a9c292e69d45a.tar.gz pyside-73fea931819ee1f6a32c50c9d67a9c292e69d45a.tar.xz pyside-73fea931819ee1f6a32c50c9d67a9c292e69d45a.zip |
Fixed QApplication cleanup.
Fixes bug #396.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r-- | PySide/QtGui/glue/qapplication_init.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index be90d10..d082b99 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -11,18 +11,18 @@ void DeleteQApplicationAtExit() QCoreApplication* cpp = QApplication::instance(); if (cpp) { Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance(); - cpp->flush(); // Delete all widgets, this is slow but is necessary to avoid problems with python object foreach(QWidget* w, QApplication::allWidgets()) { - w->deleteLater(); - //Make sure all events will send before invalidated the python object - QApplication::processEvents(); - bmngr.destroyWrapper(w); + PyObject* wrapper = bmngr.retrieveWrapper(w); + if (wrapper) { + if (SbkBaseWrapper_hasOwnership(wrapper)) + delete w; // destroy C++ object and invalidate wrapper object + else + bmngr.destroyWrapper(wrapper); // only invalidate wrapper object + } } - - cpp->processEvents(); - bmngr.destroyWrapper(cpp); + cpp->flush(); delete cpp; } } |