raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=1bdadff6c3fe4a508cc5bae4e9cdb602dc76b9ec

commit 1bdadff6c3fe4a508cc5bae4e9cdb602dc76b9ec
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Wed Jun 5 17:28:09 2019 +0100

    efm - make enlightenment_fm and eeze_scanner die with parent
    
    be both explicit in killing it off on shutdown as well as using die
    with parent flags as well. this seems ot have fixed or reduced the
    "system cant shut down some job still alive in some session" problem.
    
    @fix
---
 src/bin/e_fm.c                | 27 ++++++++++++++++++++++++++-
 src/bin/e_fm.h                |  1 +
 src/bin/e_fm/e_fm_main_eeze.c |  2 +-
 src/bin/e_sys.c               | 17 ++++++++++++-----
 4 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c
index 256c38e4e..5daa7dc29 100644
--- a/src/bin/e_fm.c
+++ b/src/bin/e_fm.c
@@ -479,6 +479,7 @@ static void          _e_fm2_thread_cleanup_cb(void *d, 
Ecore_Thread *et);
 
 static void _e_fm2_new_file(void *data, E_Menu *m, E_Menu_Item *mi);
 
+static Ecore_Exe *_e_fm2_exe = NULL;
 static char *_e_fm2_meta_path = NULL;
 static Evas_Smart *_e_fm2_smart = NULL;
 static Eina_List *_e_fm2_list = NULL;
@@ -750,6 +751,14 @@ _e_fm2_op_registry_entry_print(const 
E_Fm2_Op_Registry_Entry *ere)
        ere->src, ere->dst);
 }
 
+static Eina_Bool
+_e_fm2_exe_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+   Ecore_Exe_Event_Del *ev = event;
+   if (ev->exe == _e_fm2_exe) _e_fm2_exe = NULL;
+   return ECORE_CALLBACK_RENEW;
+}
+
 static Eina_Bool
 _e_fm2_op_registry_entry_add_cb(void *data EINA_UNUSED, int type EINA_UNUSED, 
void *event)
 {
@@ -840,6 +849,7 @@ e_fm2_init(void)
                                               _e_fm2_thread_cleanup_cb,
                                               _e_fm2_thread_cleanup_cb, NULL);
 
+   E_LIST_HANDLER_APPEND(_e_fm_handlers, ECORE_EXE_EVENT_DEL, _e_fm2_exe_del, 
NULL);
    /// DBG
    E_LIST_HANDLER_APPEND(_e_fm_handlers, E_EVENT_FM_OP_REGISTRY_ADD, 
_e_fm2_op_registry_entry_add_cb, NULL);
    E_LIST_HANDLER_APPEND(_e_fm_handlers, E_EVENT_FM_OP_REGISTRY_DEL, 
_e_fm2_op_registry_entry_del_cb, NULL);
@@ -854,6 +864,8 @@ e_fm2_init(void)
 EINTERN int
 e_fm2_shutdown(void)
 {
+   e_fm2_die();
+
    E_FREE_LIST(_e_fm2_list, evas_object_del);
 
    eina_stringshare_replace(&_e_fm2_icon_desktop_str, NULL);
@@ -887,6 +899,17 @@ e_fm2_shutdown(void)
    return 1;
 }
 
+E_API void
+e_fm2_die(void)
+{
+   if (_e_fm2_exe)
+     {
+        ecore_exe_kill(_e_fm2_exe);
+        ecore_exe_free(_e_fm2_exe);
+        _e_fm2_exe = NULL;
+     }
+}
+
 E_API Evas_Object *
 e_fm2_add(Evas *evas)
 {
@@ -2391,8 +2414,10 @@ _e_fm2_client_spawn(void)
    char buf[4096];
 
    if (_e_fm2_client_spawning) return;
+   if (e_sys_on_the_way_out_get()) return;
    snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_fm", 
e_prefix_lib_get());
-   ecore_exe_run(buf, NULL);
+   if (_e_fm2_exe) e_fm2_die();
+   _e_fm2_exe = ecore_exe_pipe_run(buf, ECORE_EXE_NOT_LEADER | 
ECORE_EXE_TERM_WITH_PARENT, NULL);
    _e_fm2_client_spawning = 1;
 }
 
diff --git a/src/bin/e_fm.h b/src/bin/e_fm.h
index 6bf0396a8..89dfcc42b 100644
--- a/src/bin/e_fm.h
+++ b/src/bin/e_fm.h
@@ -150,6 +150,7 @@ typedef void (*E_Fm_Cb)(void *data, Evas_Object *obj, 
E_Menu *m, E_Fm2_Icon_Info
 
 EINTERN int           e_fm2_init(void);
 EINTERN int           e_fm2_shutdown(void);
+E_API void             e_fm2_die(void);
 E_API Evas_Object     *e_fm2_add(Evas *evas);
 E_API void             e_fm2_path_set(Evas_Object *obj, const char *dev, const 
char *path);
 E_API void             e_fm2_custom_theme_set(Evas_Object *obj, const char 
*path);
diff --git a/src/bin/e_fm/e_fm_main_eeze.c b/src/bin/e_fm/e_fm_main_eeze.c
index b7d9e3eba..0fcffa249 100644
--- a/src/bin/e_fm/e_fm_main_eeze.c
+++ b/src/bin/e_fm/e_fm_main_eeze.c
@@ -654,7 +654,7 @@ _scanner_run(void)
 {
    static int count;
 
-   scanner = ecore_exe_pipe_run("eeze_scanner", ECORE_EXE_NOT_LEADER, pfx);
+   scanner = ecore_exe_pipe_run("eeze_scanner", ECORE_EXE_NOT_LEADER | 
ECORE_EXE_TERM_WITH_PARENT, pfx);
    if (!scanner)
      if (++count == 3)
        _e_fm_main_catch(EFM_MODE_USING_RASTER_MOUNT);
diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c
index 27157a362..250925b84 100644
--- a/src/bin/e_sys.c
+++ b/src/bin/e_sys.c
@@ -1079,7 +1079,10 @@ _e_sys_action_do(E_Sys_Action a, char *param 
EINA_UNUSED, Eina_Bool raw)
       case E_SYS_EXIT:
         // XXX TODO: check for e_fm_op_registry entries and confirm
         if (!e_util_immortal_check())
-          ecore_main_loop_quit();
+          {
+             e_fm2_die();
+             ecore_main_loop_quit();
+          }
         else
           return 0;
         break;
@@ -1088,10 +1091,11 @@ _e_sys_action_do(E_Sys_Action a, char *param 
EINA_UNUSED, Eina_Bool raw)
         // XXX TODO: check for e_fm_op_registry entries and confirm
         // FIXME: we don't share out immortal info to restarted e. :(
 //     if (!e_util_immortal_check())
-      {
-         restart = 1;
-         ecore_main_loop_quit();
-      }
+          {
+             e_fm2_die();
+             restart = 1;
+             ecore_main_loop_quit();
+          }
 //        else
 //          return 0;
       break;
@@ -1104,6 +1108,7 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, 
Eina_Bool raw)
         // XXX TODO: check for e_fm_op_registry entries and confirm
         if (raw)
           {
+             e_fm2_die();
              _e_sys_logout_after();
           }
         else if (!_e_sys_comp_waiting)
@@ -1116,6 +1121,7 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, 
Eina_Bool raw)
       case E_SYS_HALT_NOW:
         /* shutdown -h now */
         if (e_util_immortal_check()) return 0;
+        e_fm2_die();
         snprintf(buf, sizeof(buf),
                  "%s/enlightenment/utils/enlightenment_sys halt",
                  e_prefix_lib_get());
@@ -1151,6 +1157,7 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, 
Eina_Bool raw)
       case E_SYS_REBOOT:
         /* shutdown -r now */
         if (e_util_immortal_check()) return 0;
+        e_fm2_die();
         snprintf(buf, sizeof(buf),
                  "%s/enlightenment/utils/enlightenment_sys reboot",
                  e_prefix_lib_get());

-- 


Reply via email to