fix nasty bug of timers not being re-evaluated on rare case.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 6 Jun 2009 22:31:34 +0000 (22:31 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 6 Jun 2009 22:31:34 +0000 (22:31 +0000)
If there are no other main loop activity than a idlers and one idler
adds a timer, the new (and unique) timer would be ignored since it's
flagged as "just_added" and thus next iteration will not consider it,
possible entering an infinite wait as it could be the only thing to do
in main loop.

Antognolli found this nasty bug while handling timeout-and-die in
Ethumb, where the "disconnect" event is dispatched by EDBus from idler
and it was adding a timer to shutdown the daemon after a while without
clients.

By: Rafael Antognolli <antognolli@profusion.mobi>

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@40923 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore/ecore_main.c

index 1427bfc..07e1b12 100644 (file)
@@ -545,8 +545,6 @@ _ecore_main_loop_iterate_internal(int once_only)
         while (_ecore_timer_call(now));
        _ecore_timer_cleanup();
      }
-   /* any timers re-added as a result of these are allowed to go */
-   _ecore_timer_enable_new();
    /* process signals into events .... */
    while (_ecore_signal_count_get()) _ecore_signal_call();
    if (_ecore_event_exist())
@@ -596,6 +594,8 @@ _ecore_main_loop_iterate_internal(int once_only)
          _ecore_fps_debug_runtime_add(t2 - t1);
      }
    start_loop:
+   /* any timers re-added as a result of these are allowed to go */
+   _ecore_timer_enable_new();
    if (do_quit)
      {
        in_main_loop--;