discomfitor pushed a commit to branch master.

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

commit ef09d3e620d0bd08be990dad1276da6ec5c21a32
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Tue Nov 24 15:26:10 2015 -0500

    add mechanism for preventing unload of important modules during runtime
    
    if a wayland output module is unloaded while the compositor is still
    active, bad things will happen
---
 src/bin/e_module.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/bin/e_module.c b/src/bin/e_module.c
index ffae12f..c211b93 100644
--- a/src/bin/e_module.c
+++ b/src/bin/e_module.c
@@ -147,6 +147,27 @@ _module_is_nosave(const char *name)
    return !strncmp(name, "wl_", 3); //block wl_* modules from being saved
 }
 
+static Eina_Bool
+_module_is_important(const char *name)
+{
+   const char *list[] =
+   {
+      "xwayland",
+      "wl_desktop_shell",
+      "wl_drm",
+      "wl_fb",
+      "wl_text_input",
+      "wl_weekeyboard",
+      "wl_wl",
+      "wl_x11",
+   };
+   unsigned int i;
+
+   for (i = 0; i < EINA_C_ARRAY_LENGTH(list); i++)
+     if (eina_streq(name, list[i])) return EINA_TRUE;
+   return EINA_FALSE;
+}
+
 /* externally accessible functions */
 EINTERN int
 e_module_init(void)
@@ -535,6 +556,7 @@ e_module_disable(E_Module *m)
    E_OBJECT_CHECK_RETURN(m, 0);
    E_OBJECT_TYPE_CHECK_RETURN(m, E_MODULE_TYPE, 0);
    if ((!m->enabled) || (m->error)) return 0;
+   if ((!stopping) && _module_is_important(m->name)) return 0;
    ret = m->func.shutdown ? m->func.shutdown(m) : 1;
    m->data = NULL;
    m->enabled = 0;

-- 


Reply via email to