summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2018-08-27 12:09:49 +0900
committerHermet Park <hermetpark@gmail.com>2018-08-27 12:09:49 +0900
commit1d7fb47f04097e6e11c052404cfb086c2ba7accc (patch)
tree770cffcc42412204de587fc44273d41bb82faa92 /src/lib/ecore
parentd1e4c6bab84e55837a70b8883a28e7eb6d49db09 (diff)
efl/timer: correctly handle timer freeze during construction
Summary: it is not correct to throw an error when methods are called during construction Reviewers: Hermet Reviewed By: Hermet Subscribers: Hermet, cedric, #reviewers, #committers Tags: #efl_main_loop Differential Revision: https://phab.enlightenment.org/D6787
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/ecore_timer.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c
index 776848875c..1beae5d0a4 100644
--- a/src/lib/ecore/ecore_timer.c
+++ b/src/lib/ecore/ecore_timer.c
@@ -327,14 +327,12 @@ _efl_loop_timer_efl_object_event_freeze(Eo *obj, Efl_Loop_Timer_Data *timer)
327 // Timer already frozen 327 // Timer already frozen
328 if (timer->frozen) return; 328 if (timer->frozen) return;
329 329
330 if (EINA_UNLIKELY(!timer->initialized))
331 {
332 ERR("Attempt freezing an non unfinalized timer.");
333 return;
334 }
335
336 now = efl_loop_time_get(timer->loop); 330 now = efl_loop_time_get(timer->loop);
337 timer->pending = timer->at - now; 331 /* only if timer interval has been set */
332 if (timer->initialized)
333 timer->pending = timer->at - now;
334 else
335 timer->pending = 0.0;
338 timer->at = 0.0; 336 timer->at = 0.0;
339 timer->frozen = 1; 337 timer->frozen = 1;
340 338
@@ -369,6 +367,7 @@ _efl_loop_timer_efl_object_event_thaw(Eo *obj, Efl_Loop_Timer_Data *timer)
369 efl_event_thaw(efl_super(obj, MY_CLASS)); 367 efl_event_thaw(efl_super(obj, MY_CLASS));
370 368
371 if (!timer->frozen) return; // Timer not frozen 369 if (!timer->frozen) return; // Timer not frozen
370 timer->frozen = 0;
372 371
373 if (timer->loop_data) 372 if (timer->loop_data)
374 { 373 {
@@ -659,12 +658,14 @@ _efl_loop_timer_set(Efl_Loop_Timer_Data *timer, double at, double in)
659{ 658{
660 if (!timer->loop_data) return; 659 if (!timer->loop_data) return;
661 timer->loop_data->timers_added = 1; 660 timer->loop_data->timers_added = 1;
662 timer->at = at;
663 timer->in = in; 661 timer->in = in;
664 timer->just_added = 1; 662 timer->just_added = 1;
665 timer->initialized = 1; 663 timer->initialized = 1;
666 timer->frozen = 0; 664 if (!timer->frozen)
667 timer->pending = 0.0; 665 {
666 timer->at = at;
667 timer->pending = 0.0;
668 }
668 _efl_loop_timer_util_instanciate(timer->loop_data, timer); 669 _efl_loop_timer_util_instanciate(timer->loop_data, timer);
669} 670}
670 671