ecore: handle initialization of timer correctly.

This commit is contained in:
Cedric BAIL 2017-02-06 14:29:56 -08:00
parent 1b4a2c0ac9
commit de83cc77d3
1 changed files with 10 additions and 11 deletions

View File

@ -125,7 +125,7 @@ _efl_loop_timer_efl_object_constructor(Eo *obj, Efl_Loop_Timer_Data *timer)
efl_wref_add(obj, &timer->object); efl_wref_add(obj, &timer->object);
timer->initialized = 0; timer->initialized = EINA_FALSE;
return obj; return obj;
} }
@ -133,13 +133,18 @@ _efl_loop_timer_efl_object_constructor(Eo *obj, Efl_Loop_Timer_Data *timer)
EOLIAN static Eo * EOLIAN static Eo *
_efl_loop_timer_efl_object_finalize(Eo *obj, Efl_Loop_Timer_Data *pd) _efl_loop_timer_efl_object_finalize(Eo *obj, Efl_Loop_Timer_Data *pd)
{ {
if (!pd->initialized) if (pd->at < ecore_loop_time_get())
{ {
ERR("Timer has not been initialized during construction as mandated."); pd->at = ecore_time_get() + pd->in;
return NULL; }
else
{
pd->at += pd->in;
} }
_efl_loop_timer_util_instanciate(pd); pd->initialized = EINA_TRUE;
_efl_loop_timer_set(pd, pd->at, pd->in);
return efl_finalize(efl_super(obj, MY_CLASS)); return efl_finalize(efl_super(obj, MY_CLASS));
} }
@ -261,12 +266,6 @@ _efl_loop_timer_interval_set(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer, do
if (in < 0.0) in = 0.0; if (in < 0.0) in = 0.0;
timer->in = in; timer->in = in;
if (!timer->initialized)
{
timer->at = ecore_time_get();
_efl_loop_timer_set(timer, timer->at + in, in);
}
} }
EOLIAN static double EOLIAN static double