fix infinite loop when ecore_main_loop_glib_integrate is called 93/66493/3 accepted/tizen/common/20160420.140601 accepted/tizen/ivi/20160420.042830 accepted/tizen/mobile/20160420.042743 accepted/tizen/tv/20160420.042800 accepted/tizen/wearable/20160420.042814 submit/tizen/20160419.072838
authorBoram Park <boram1288.park@samsung.com>
Tue, 19 Apr 2016 07:16:51 +0000 (16:16 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 19 Apr 2016 07:36:34 +0000 (00:36 -0700)
   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

index a3e0098..66b4c7f 100644 (file)
@@ -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;