Avoid getting stuck into ecore main loop dispatchers.

The old way we could run endless with the following case:

   int my_buggy_idler(void *data) {
       ecore_idler_add(my_buggy_idler, NULL);
       return 0;
   }

since it would append to that list, then the list would never end.

Now we just dispatch up to the last know idler, then go back to
regular processing, if nothing happens we'll be back to dispatch
again.

I tested it here and works fine, but might show issues with ecore
enterers/exiters of some applications that rely on the old (broken)
behavior.



SVN revision: 40847
This commit is contained in:
Gustavo Sverzut Barbieri 2009-05-29 16:33:00 +00:00
parent f94a0f29a2
commit 0664a8fd5e
3 changed files with 15 additions and 3 deletions

View File

@ -99,7 +99,9 @@ _ecore_idle_enterer_shutdown(void)
void
_ecore_idle_enterer_call(void)
{
Ecore_List2 *l;
Ecore_List2 *l, *last;
last = idle_enterers ? ((Ecore_List2 *)idle_enterers)->last : NULL;
for (l = (Ecore_List2 *)idle_enterers; l; l = l->next)
{
@ -110,6 +112,8 @@ _ecore_idle_enterer_call(void)
{
if (!ie->func(ie->data)) ecore_idle_enterer_del(ie);
}
if (l == last) break;
}
if (idle_enterers_delete_me)
{

View File

@ -75,7 +75,9 @@ _ecore_idle_exiter_shutdown(void)
void
_ecore_idle_exiter_call(void)
{
Ecore_List2 *l;
Ecore_List2 *l, *last;
last = idle_exiters ? ((Ecore_List2 *)idle_exiters)->last : NULL;
for (l = (Ecore_List2 *)idle_exiters; l; l = l->next)
{
@ -86,6 +88,8 @@ _ecore_idle_exiter_call(void)
{
if (!ie->func(ie->data)) ecore_idle_exiter_del(ie);
}
if (l == last) break;
}
if (idle_exiters_delete_me)
{

View File

@ -83,7 +83,9 @@ _ecore_idler_shutdown(void)
int
_ecore_idler_call(void)
{
Ecore_List2 *l;
Ecore_List2 *l, *last;
last = idlers ? ((Ecore_List2 *)idlers)->last : NULL;
for (l = (Ecore_List2 *)idlers; l; l = l->next)
{
@ -94,6 +96,8 @@ _ecore_idler_call(void)
{
if (!ie->func(ie->data)) ecore_idler_del(ie);
}
if (l == last) break;
}
if (idlers_delete_me)
{