X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/10e7e45ae92d4fe06f70126ed256b87896dbc432..0c59a4279f93f08fe95fca5f2e55f3e025f0cceb:/lib/base/ebase.cpp diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp index a66d1958..bd2ec589 100644 --- a/lib/base/ebase.cpp +++ b/lib/base/ebase.cpp @@ -39,7 +39,8 @@ void eSocketNotifier::stop() } } - // timer +DEFINE_REF(eTimer); + void eTimer::start(long msek, bool singleShot) { if (bActive) @@ -160,7 +161,12 @@ int eMainloop::processOneEvent(unsigned int twisted_timeout, PyObject **res, ePy { /* process all timers which are ready. first remove them out of the list. */ while (!m_timer_list.empty() && (poll_timeout = timeout_usec( m_timer_list.begin()->getNextActivation() ) ) <= 0 ) - m_timer_list.begin()->activate(); + { + eTimer *tmr = m_timer_list.begin(); + tmr->AddRef(); + tmr->activate(); + tmr->Release(); + } if (poll_timeout < 0) poll_timeout = 0; else /* convert us to ms */ @@ -403,7 +409,7 @@ eTimerPy_dealloc(eTimerPy* self) if (self->in_weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) self); eTimerPy_clear(self); - delete self->tm; + self->tm->Release(); self->ob_type->tp_free((PyObject*)self); } @@ -411,7 +417,8 @@ static PyObject * eTimerPy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { eTimerPy *self = (eTimerPy *)type->tp_alloc(type, 0); - self->tm = new eTimer(eApp); + self->tm = eTimer::create(eApp); + self->tm->AddRef(); self->in_weakreflist = NULL; return (PyObject *)self; }