aboutsummaryrefslogtreecommitdiff
path: root/lib/base/ebase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/base/ebase.cpp')
-rw-r--r--lib/base/ebase.cpp15
1 files changed, 11 insertions, 4 deletions
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;
}