From 505c25b1213b38ea9c0e5bf530e951251e4adf5c Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 19 Apr 2016 16:16:51 +0900 Subject: [PATCH] fix infinite loop when ecore_main_loop_glib_integrate is called Efl is working based on X in case of tizen IDE. In this case, ecore_main_loop_glib_integrate is not called. Change-Id: I72f94c70f9fe0f5b1b553fce36d8fb960fb870a6 --- src/lib/ecore/ecore_main.c | 44 +++++++++----------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index a3e0098..66b4c7f 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -254,6 +254,7 @@ Ecore_Select_Function main_loop_select = NULL; # endif #endif +static Eina_Bool need_fdh_mark_active = EINA_FALSE; static Eina_List *awake_funcs = NULL; #ifndef USE_G_MAIN_LOOP @@ -521,6 +522,8 @@ _ecore_main_fdh_mark_active(fd_set *rfds, fd_set *wfds, fd_set *exfds) Eina_List *l; int ret = 0; + need_fdh_mark_active = EINA_FALSE; + if (HAVE_EPOLL && epoll_fd >= 0) ret = _ecore_main_fdh_epoll_mark_active(); else @@ -1578,6 +1581,8 @@ _ecore_main_select(double timeout) } if (_ecore_signal_count_get()) return -1; + need_fdh_mark_active = EINA_TRUE; + _ecore_unlock(); eina_evlog("!SLEEP", NULL, 0.0, t ? "timeout" : "forever"); ret = main_loop_select(max_fd + 1, &rfds, &wfds, &exfds, t); @@ -1595,48 +1600,17 @@ _ecore_main_select(double timeout) } if (ret > 0) { -#ifndef HAVE_GLIB - if (HAVE_EPOLL && epoll_fd >= 0) - _ecore_main_fdh_epoll_mark_active(); - else - { - EINA_INLIST_FOREACH(fd_handlers, fdh) - { - if (!fdh->delete_me) - { - if (FD_ISSET(fdh->fd, &rfds)) - fdh->read_active = EINA_TRUE; - if (FD_ISSET(fdh->fd, &wfds)) - fdh->write_active = EINA_TRUE; - if (FD_ISSET(fdh->fd, &exfds)) - fdh->error_active = EINA_TRUE; - _ecore_try_add_to_call_list(fdh); - } - } - } - EINA_LIST_FOREACH(file_fd_handlers, l, fdh) + if (need_fdh_mark_active) { - if (!fdh->delete_me) - { - if (FD_ISSET(fdh->fd, &rfds)) - fdh->read_active = EINA_TRUE; - if (FD_ISSET(fdh->fd, &wfds)) - fdh->write_active = EINA_TRUE; - if (FD_ISSET(fdh->fd, &exfds)) - fdh->error_active = EINA_TRUE; - _ecore_try_add_to_call_list(fdh); - } + _ecore_main_fdh_mark_active(&rfds, &wfds, &exfds); + _ecore_main_awake_handler_call(); } -#endif + _ecore_main_fd_handlers_cleanup(); #ifdef _WIN32 _ecore_main_win32_handlers_cleanup(); #endif -#ifndef HAVE_GLIB - _ecore_main_awake_handler_call(); -#endif - return 1; } return 0; -- 2.7.4