efl_wref_add(obj, &timer->object);
- timer->at = ecore_time_get();
timer->initialized = 0;
return obj;
}
-
EOLIAN static Eo *
_efl_loop_timer_efl_object_finalize(Eo *obj, Efl_Loop_Timer_Data *pd)
{
+ if (!pd->initialized)
+ {
+ ERR("Timer has not been initialized during construction as mandated.");
+ return NULL;
+ }
+
_efl_loop_timer_util_instanciate(pd);
return efl_finalize(efl_super(obj, MY_CLASS));
timer->in = in;
if (!timer->initialized)
- _efl_loop_timer_set(timer, timer->at + in, in);
+ {
+ timer->at = ecore_time_get();
+ _efl_loop_timer_set(timer, timer->at + in, in);
+ }
}
EOLIAN static double
if (timer->frozen)
return;
- now = ecore_time_get();
+ if (EINA_UNLIKELY(!timer->initialized))
+ {
+ ERR("Attempt freezing an non initialized timer.");
+ return;
+ }
+ now = ecore_loop_time_get();
timer->pending = timer->at - now;
+
timer->at = 0.0;
timer->frozen = 1;
return ;
}
+ if (!timer->initialized)
+ {
+ ERR("Trying to instanciate an uninitialized timer is impossible.");
+ return ;
+ }
+
EINA_INLIST_REVERSE_FOREACH(timers, t2)
{
if (timer->at > t2->at)
_efl_loop_timer_util_delay(Efl_Loop_Timer_Data *timer,
double add)
{
+ if (!timer->initialized)
+ {
+ ERR("Impossible to delay an uninitialized timer.");
+ return ;
+ }
+
if (timer->frozen)
{
timer->pending += add;
EINA_INLIST_FOREACH(EINA_INLIST_GET(base)->next, timer)
{
+ if (EINA_UNLIKELY(!timer->initialized)) continue; // This shouldn't happen
if (timer->at >= maxtime) break;
if (!timer->just_added)
valid_timer = timer;
now = ecore_loop_time_get();
in = first->at - now;
if (in < 0) in = 0;
+
return in;
}