cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=de83cc77d3a8864ed3cf367a860a6573ceabe8d7

commit de83cc77d3a8864ed3cf367a860a6573ceabe8d7
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Mon Feb 6 14:29:56 2017 -0800

    ecore: handle initialization of timer correctly.
---
 src/lib/ecore/ecore_timer.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c
index 0bf770c..2d3115b 100644
--- a/src/lib/ecore/ecore_timer.c
+++ b/src/lib/ecore/ecore_timer.c
@@ -125,7 +125,7 @@ _efl_loop_timer_efl_object_constructor(Eo *obj, 
Efl_Loop_Timer_Data *timer)
 
    efl_wref_add(obj, &timer->object);
 
-   timer->initialized = 0;
+   timer->initialized = EINA_FALSE;
 
    return obj;
 }
@@ -133,13 +133,18 @@ _efl_loop_timer_efl_object_constructor(Eo *obj, 
Efl_Loop_Timer_Data *timer)
 EOLIAN static Eo *
 _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.");
-        return NULL;
+        pd->at = ecore_time_get() + pd->in;
      }
+   else
+     {
+        pd->at += pd->in;
+     }
+
+   pd->initialized = EINA_TRUE;
 
-   _efl_loop_timer_util_instanciate(pd);
+   _efl_loop_timer_set(pd, pd->at, pd->in);
 
    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;
 
    timer->in = in;
-
-   if (!timer->initialized)
-     {
-        timer->at = ecore_time_get();
-        _efl_loop_timer_set(timer, timer->at + in, in);
-     }
 }
 
 EOLIAN static double

-- 


Reply via email to