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>
This commit is contained in:
renatofilho 2010-09-17 17:03:01 -03:00
commit 6974551674
6 changed files with 59 additions and 20 deletions

View file

@ -24,18 +24,22 @@
#include "pyside.h"
#include "signalmanager.h"
#include "qproperty.h"
#include "qsignal.h"
#include <basewrapper.h>
#include <conversions.h>
#include <algorithm>
#include "qsignal.h"
#include <QStack>
extern "C" void init_signal(PyObject* module);
extern "C" void init_slot(PyObject* module);
extern "C" void init_qproperty(PyObject* module);
static QStack<PySide::CleanupFunction> cleanupFunctionList;
namespace PySide
{
void init(PyObject *module)
{
init_signal(module);
@ -82,5 +86,20 @@ bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds
return true;
}
void registerCleanupFunction(CleanupFunction func)
{
cleanupFunctionList.push(func);
}
void runCleanupFunctions()
{
while (!cleanupFunctionList.isEmpty()) {
CleanupFunction f = cleanupFunctionList.pop();
f();
}
}
} //namespace PySide