diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-09-17 17:03:01 -0300 |
---|---|---|
committer | renatofilho <renato.filho@openbossa.org> | 2010-09-17 18:54:08 -0300 |
commit | 6974551674d72a828ff9ae19af510c90a62a09ec (patch) | |
tree | 1dac32e9240ede7429569b4d25b672e8c017022a /PySide/QtCore/glue | |
parent | b8436f6b1e1efb4da51c6bcc6c22d997541d10c6 (diff) |
Created PySide cleanup functions used to register functions to be called before the python die.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'PySide/QtCore/glue')
-rw-r--r-- | PySide/QtCore/glue/qcoreapplication_init.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/PySide/QtCore/glue/qcoreapplication_init.cpp b/PySide/QtCore/glue/qcoreapplication_init.cpp index 7601dbd1d..14ccbb8f9 100644 --- a/PySide/QtCore/glue/qcoreapplication_init.cpp +++ b/PySide/QtCore/glue/qcoreapplication_init.cpp @@ -1,21 +1,20 @@ // Global variables used to store argc and argv values static int QCoreApplicationArgCount; static char** QCoreApplicationArgValues; -static bool leavingPython = false; /** * Called at QtCore module exit */ void DeleteQCoreApplicationAtExit() { - leavingPython = true; QCoreApplication *cpp = QCoreApplication::instance(); if (cpp) { Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance(); PyObject* pySelf = bmngr.retrieveWrapper(cpp); - if (pySelf) - bmngr.invalidateWrapper(pySelf); - cpp->deleteLater(); + cpp->flush(); + QCoreApplication::processEvents(); + bmngr.invalidateWrapper(pySelf); + delete cpp; } } @@ -54,7 +53,7 @@ int SbkQCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) PySide::signalUpdateSource(self); cptr->metaObject(); - Py_AtExit(DeleteQCoreApplicationAtExit); + PySide::registerCleanupFunction(DeleteQCoreApplicationAtExit); Py_INCREF(self); return 1; } |