From 10e7e45ae92d4fe06f70126ed256b87896dbc432 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Wed, 29 Oct 2008 19:46:57 +0000 Subject: better solution to add possibility to delete eSocketNotifiers, eConsoleAppContainers in callback funktions without crash --- lib/python/connections.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'lib/python/connections.cpp') diff --git a/lib/python/connections.cpp b/lib/python/connections.cpp index b54c07b1..c0d38f89 100644 --- a/lib/python/connections.cpp +++ b/lib/python/connections.cpp @@ -1,14 +1,11 @@ #include PSignal::PSignal() - :m_destroyed(0) { } PSignal::~PSignal() { - if (m_destroyed) - *m_destroyed = true; Py_XDECREF(m_list); } @@ -23,12 +20,21 @@ void PSignal::callPython(ePyObject tuple) } } -PyObject *PSignal::get(bool steal) +PyObject *PSignal::get() { - if (!steal) { - if (!m_list) - m_list = PyList_New(0); - Py_INCREF(m_list); + if (!m_list) + m_list = PyList_New(0); + Py_INCREF(m_list); + return m_list; +} + +PyObject *PSignal::getSteal(bool clear) +{ + if (clear) + { + ePyObject ret = m_list; + m_list = (PyObject*)0; + return ret; } return m_list; } -- cgit v1.2.3