X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2Fconnections.h;h=ab123137db9a2ec6fc6d5538946e47fe210cd35c;hp=76859e7df3c7f8abf5edf9b6b624672da01abdd5;hb=7542f853b1a682ad9bf21b592f26e31e3b64521c;hpb=636b9f54ca8b7e51fadfac03cf9703648106c548 diff --git a/lib/python/connections.h b/lib/python/connections.h index 76859e7..ab12313 100644 --- a/lib/python/connections.h +++ b/lib/python/connections.h @@ -14,6 +14,7 @@ class PSignal { protected: ePyObject m_list; + bool *m_destroyed; public: PSignal(); ~PSignal(); @@ -37,13 +38,18 @@ class PSignal0: public PSignal, public Signal0 public: R operator()() { + bool destroyed=false; + m_destroyed = &destroyed; if (m_list) { PyObject *pArgs = PyTuple_New(0); callPython(pArgs); Org_Py_DECREF(pArgs); } - return Signal0::operator()(); + if (!destroyed) { + m_destroyed = 0; + return Signal0::operator()(); + } } }; @@ -53,6 +59,8 @@ class PSignal1: public PSignal, public Signal1 public: R operator()(V0 a0) { + bool destroyed=false; + m_destroyed = &destroyed; if (m_list) { PyObject *pArgs = PyTuple_New(1); @@ -60,7 +68,10 @@ public: callPython(pArgs); Org_Py_DECREF(pArgs); } - return Signal1::operator()(a0); + if (!destroyed) { + m_destroyed = 0; + return Signal1::operator()(a0); + } } }; @@ -70,6 +81,8 @@ class PSignal2: public PSignal, public Signal2 public: R operator()(V0 a0, V1 a1) { + bool destroyed=false; + m_destroyed = &destroyed; if (m_list) { PyObject *pArgs = PyTuple_New(2); @@ -78,7 +91,10 @@ public: callPython(pArgs); Org_Py_DECREF(pArgs); } - return Signal2::operator()(a0, a1); + if (!destroyed) { + m_destroyed = 0; + return Signal2::operator()(a0, a1); + } } };