From 77a1654ad587241d3c14bafa2c0deae53e1599ee Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Fri, 22 Oct 2010 17:28:43 -0200 Subject: Fix bugs 430, 426, 429, 394, 433. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These bugs are about QApplication instance being destroyed before some QObject. Reviewer: Luciano Wolf Renato Araújo --- PySide/QtCore/glue/qcoreapplication_init.cpp | 17 +---------------- PySide/QtGui/glue/qapplication_init.cpp | 24 +----------------------- 2 files changed, 2 insertions(+), 39 deletions(-) (limited to 'PySide') diff --git a/PySide/QtCore/glue/qcoreapplication_init.cpp b/PySide/QtCore/glue/qcoreapplication_init.cpp index 461757cc3..66247bfc8 100644 --- a/PySide/QtCore/glue/qcoreapplication_init.cpp +++ b/PySide/QtCore/glue/qcoreapplication_init.cpp @@ -2,21 +2,6 @@ static int QCoreApplicationArgCount; static char** QCoreApplicationArgValues; -/** - * Called at QtCore module exit - */ -void DeleteQCoreApplicationAtExit() -{ - QCoreApplication *cpp = QCoreApplication::instance(); - if (cpp) { - Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance(); - cpp->flush(); - QCoreApplication::processEvents(); - bmngr.destroyWrapper(cpp); - delete cpp; - } -} - int SbkQCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) { if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType())) @@ -52,7 +37,7 @@ int SbkQCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) PySide::signalUpdateSource(self); cptr->metaObject(); - PySide::registerCleanupFunction(DeleteQCoreApplicationAtExit); + PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); Py_INCREF(self); return 1; } diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index d082b99f1..ba98f029a 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -5,28 +5,6 @@ static int QApplicationArgCount; static char** QApplicationArgValues; static const char QAPP_MACRO[] = "qApp"; -void DeleteQApplicationAtExit() -{ - PySide::SignalManager::instance().clear(); - QCoreApplication* cpp = QApplication::instance(); - if (cpp) { - Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance(); - - // Delete all widgets, this is slow but is necessary to avoid problems with python object - foreach(QWidget* w, QApplication::allWidgets()) { - 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->flush(); - delete cpp; - } -} - int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*) { if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType())) @@ -69,7 +47,7 @@ int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*) } PyObject_SetAttrString(moduleQtGui, QAPP_MACRO, self); - PySide::registerCleanupFunction(DeleteQApplicationAtExit); + PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); Py_INCREF(self); return 1; } -- cgit v1.2.3