cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=aa4da11b33920b7f7be92e870fd4bd9fbd26da1c

commit aa4da11b33920b7f7be92e870fd4bd9fbd26da1c
Author: Cedric Bail <[email protected]>
Date:   Tue May 17 07:38:36 2016 -0700

    ecore: do not create another main loop object
    
    So ecore main loop does restart everything with an main loop shutdown
    and init when it detect a bad fd. This can happen if you del a fd after
    you have destroyed it. Something terminology is doing (and should be
    legal), but that then ended up with a main loop with no event handler
    registered and the process was looking like stuck with nothing happening.
---
 src/lib/ecore/ecore.c      | 2 ++
 src/lib/ecore/ecore_main.c | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index e403a0d..6c53333 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -257,6 +257,8 @@ ecore_init(void)
    vpath = eo_add(EFL_VPATH_CORE_CLASS, NULL);
    if (vpath) efl_vpath_manager_register(EFL_VPATH_MANAGER_CLASS, 0, vpath);
 
+   _mainloop_singleton = eo_add(EFL_LOOP_CLASS, NULL);
+
    _ecore_signal_init();
 #ifndef HAVE_EXOTIC
    _ecore_exe_init();
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index 93f1d1c..760a187 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -1030,6 +1030,8 @@ quit:
 void
 _ecore_main_loop_init(void)
 {
+   // Please note that this function is being also called in case of a bad fd 
to reset the main loop.
+
    DBG("_ecore_main_loop_init");
    epoll_fd = epoll_create(1);
    if ((epoll_fd < 0) && HAVE_EPOLL)
@@ -1117,7 +1119,7 @@ _ecore_main_loop_init(void)
      DBG("loaded dlsyms uv");
    }
 #endif
-   
+
    /* setup for the g_main_loop only integration */
 #ifdef USE_G_MAIN_LOOP
    ecore_glib_source = g_source_new(&ecore_gsource_funcs, sizeof (GSource));
@@ -1155,13 +1157,13 @@ _ecore_main_loop_init(void)
 #endif
 
    detect_time_changes_start();
-
-   _mainloop_singleton = eo_add(EFL_LOOP_CLASS, NULL);
 }
 
 void
 _ecore_main_loop_shutdown(void)
 {
+   // Please note that _ecore_main_loop_shutdown is called in cycle to restart 
the main loop in case of a bad fd
+
 #ifdef USE_G_MAIN_LOOP
    if (ecore_glib_source)
      {

-- 


Reply via email to