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:
parent
b8436f6b1e
commit
6974551674
6 changed files with 59 additions and 20 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue