aboutsummaryrefslogtreecommitdiffstats
path: root/libpyside/pyside.cpp
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-09-17 17:03:01 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-09-17 18:54:08 -0300
commit6974551674d72a828ff9ae19af510c90a62a09ec (patch)
tree1dac32e9240ede7429569b4d25b672e8c017022a /libpyside/pyside.cpp
parentb8436f6b1e1efb4da51c6bcc6c22d997541d10c6 (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 'libpyside/pyside.cpp')
-rw-r--r--libpyside/pyside.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp
index ddec19803..bd4ab7c64 100644
--- a/libpyside/pyside.cpp
+++ b/libpyside/pyside.cpp
@@ -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