aboutsummaryrefslogtreecommitdiff
path: root/lib/base
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-11-25 17:18:48 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-11-25 17:18:48 +0000
commit6dcb75c26bbfec04b381bb99d75404f9fe50635d (patch)
treeb4b0e4e7b92c2d6563a848279cb5b48e7e183f96 /lib/base
parent26a6141301937e0ef501b4cd7ae61b4f2293b7e5 (diff)
downloadenigma2-6dcb75c26bbfec04b381bb99d75404f9fe50635d.tar.gz
enigma2-6dcb75c26bbfec04b381bb99d75404f9fe50635d.zip
python object refcount debugging code second try
Diffstat (limited to 'lib/base')
-rw-r--r--lib/base/ebase.cpp17
-rw-r--r--lib/base/ebase.h8
-rw-r--r--lib/base/nconfig.cpp10
-rw-r--r--lib/base/nconfig.h4
4 files changed, 20 insertions, 19 deletions
diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp
index 67e02347..480c8ea8 100644
--- a/lib/base/ebase.cpp
+++ b/lib/base/ebase.cpp
@@ -131,7 +131,7 @@ void eMainloop::removeSocketNotifier(eSocketNotifier *sn)
eFatal("removed socket notifier which is not present");
}
-int eMainloop::processOneEvent(unsigned int user_timeout, PyObject **res, PyObject *additional)
+int eMainloop::processOneEvent(unsigned int user_timeout, PyObject **res, ePyObject additional)
{
int return_reason = 0;
/* get current time */
@@ -222,7 +222,7 @@ int eMainloop::processOneEvent(unsigned int user_timeout, PyObject **res, PyObje
{
if (!*res)
*res = PyList_New(0);
- PyObject *it = PyTuple_New(2);
+ ePyObject it = PyTuple_New(2);
PyTuple_SET_ITEM(it, 0, PyInt_FromLong(pfd[i].fd));
PyTuple_SET_ITEM(it, 1, PyInt_FromLong(pfd[i].revents));
PyList_Append(*res, it);
@@ -272,7 +272,7 @@ void eMainloop::removeTimer(eTimer* e)
m_timer_list.remove(e);
}
-int eMainloop::iterate(unsigned int user_timeout, PyObject **res, PyObject *dict)
+int eMainloop::iterate(unsigned int user_timeout, PyObject **res, ePyObject dict)
{
int ret = 0;
@@ -320,9 +320,9 @@ void eMainloop::reset()
app_quit_now=false;
}
-PyObject *eMainloop::poll(PyObject *timeout, PyObject *dict)
+PyObject *eMainloop::poll(ePyObject timeout, ePyObject dict)
{
- PyObject *res = 0;
+ PyObject *res=0;
if (app_quit_now)
{
@@ -333,11 +333,12 @@ PyObject *eMainloop::poll(PyObject *timeout, PyObject *dict)
int user_timeout = (timeout == Py_None) ? 0 : PyInt_AsLong(timeout);
iterate(user_timeout, &res, dict);
+ ePyObject ret(res);
- if (!res) /* return empty list on timeout */
- res = PyList_New(0);
+ if (!ret) /* return empty list on timeout */
+ return PyList_New(0);
- return res;
+ return ret;
}
void eMainloop::interruptPoll()
diff --git a/lib/base/ebase.h b/lib/base/ebase.h
index cf973c89..a399667e 100644
--- a/lib/base/ebase.h
+++ b/lib/base/ebase.h
@@ -179,7 +179,7 @@ class eMainloop
ePtrList<eTimer> m_timer_list;
bool app_quit_now;
int loop_level;
- int processOneEvent(unsigned int user_timeout, PyObject **res=0, PyObject *additional=0);
+ int processOneEvent(unsigned int user_timeout, PyObject **res=0, ePyObject additional=ePyObject());
int retval;
pthread_mutex_t recalcLock;
@@ -219,14 +219,14 @@ public:
1 - timeout
2 - signal
*/
- int iterate(unsigned int timeout=0, PyObject **res=0, PyObject *additional=0);
-
+ int iterate(unsigned int timeout=0, PyObject **res=0, SWIG_PYOBJECT(ePyObject) additional=(PyObject*)0);
+
/* run will iterate endlessly until the app is quit, and return
the exit code */
int runLoop();
/* our new shared polling interface. */
- PyObject *poll(PyObject *dict, PyObject *timeout);
+ PyObject *poll(SWIG_PYOBJECT(ePyObject) dict, SWIG_PYOBJECT(ePyObject) timeout);
void interruptPoll();
void reset();
};
diff --git a/lib/base/nconfig.cpp b/lib/base/nconfig.cpp
index 562b3503..31b0a36f 100644
--- a/lib/base/nconfig.cpp
+++ b/lib/base/nconfig.cpp
@@ -1,9 +1,9 @@
#include <lib/base/nconfig.h>
-#include <Python.h>
+#include <lib/python/python.h>
-PyObject *ePythonConfigQuery::m_queryFunc;
+ePyObject ePythonConfigQuery::m_queryFunc;
-void ePythonConfigQuery::setQueryFunc(PyObject *queryFunc)
+void ePythonConfigQuery::setQueryFunc(ePyObject queryFunc)
{
if (m_queryFunc)
Py_DECREF(m_queryFunc);
@@ -16,9 +16,9 @@ RESULT ePythonConfigQuery::getConfigValue(const char *key, std::string &value)
{
if (key && PyCallable_Check(m_queryFunc))
{
- PyObject *pArgs = PyTuple_New(1);
+ ePyObject pArgs = PyTuple_New(1);
PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(key));
- PyObject *pRet = PyObject_CallObject(m_queryFunc, pArgs);
+ ePyObject pRet = PyObject_CallObject(m_queryFunc, pArgs);
Py_DECREF(pArgs);
if (pRet)
{
diff --git a/lib/base/nconfig.h b/lib/base/nconfig.h
index 2c87491a..36674392 100644
--- a/lib/base/nconfig.h
+++ b/lib/base/nconfig.h
@@ -5,11 +5,11 @@
class ePythonConfigQuery
{
- static PyObject *m_queryFunc;
+ static ePyObject m_queryFunc;
ePythonConfigQuery() {}
~ePythonConfigQuery() {}
public:
- static void setQueryFunc(PyObject *func);
+ static void setQueryFunc(SWIG_PYOBJECT(ePyObject) func);
#ifndef SWIG
static RESULT getConfigValue(const char *key, std::string &value);
#endif