aboutsummaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-10-22 17:28:43 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-10-22 19:16:51 -0200
commit77a1654ad587241d3c14bafa2c0deae53e1599ee (patch)
tree1b2dece9fe99a5a956420e03229d0872916a9a05 /PySide
parent800fb4613cb61dbff33750ec0ab4b18ca3369c6c (diff)
Fix bugs 430, 426, 429, 394, 433.
These bugs are about QApplication instance being destroyed before some QObject. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r--PySide/QtCore/glue/qcoreapplication_init.cpp17
-rw-r--r--PySide/QtGui/glue/qapplication_init.cpp24
2 files changed, 2 insertions, 39 deletions
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<QApplication >()))
@@ -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<QApplication >()))
@@ -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;
}