Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/lib


Modified Files:
        etk_engine.c etk_engine.h 


Log Message:
* Do not dlclose() while the engine is still loaded... Bad MoOm!!


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_engine.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk_engine.c        27 Jul 2006 16:49:35 -0000      1.2
+++ etk_engine.c        27 Jul 2006 17:22:03 -0000      1.3
@@ -80,34 +80,16 @@
    {
       Etk_Engine *engine;
       void *(*engine_shutdown)();   
-      char filename[PATH_MAX];
-      void *handle;
-      
       engine = _loaded_engines->data;
       _loaded_engines = evas_list_remove(_loaded_engines, engine);
       
-      if (!engine->engine_name)
-         continue;
-      
-      snprintf(filename, sizeof(filename), "%s/etk/engines/%s.so", 
PACKAGE_LIB_DIR, engine->engine_name);
-      
-      if (!ecore_file_exists(filename))
-      {
-         ETK_WARNING("Etk can not find requested engine!");
-         return;
-      }
-      
-      handle = dlopen(filename, RTLD_LAZY | RTLD_GLOBAL);
-      if (!handle)
-      {
-         ETK_WARNING("Etk can not dlopen requested engine!");
+      if (!engine->handle)
          continue;
-      }
 
-      if ((engine_shutdown = dlsym(handle, "engine_shutdown")))
+      if ((engine_shutdown = dlsym(engine->handle, "engine_shutdown")))
          engine_shutdown();
       
-      dlclose(handle);
+      dlclose(engine->handle);
    }
    
    while (_etk_engines)
@@ -203,7 +185,8 @@
       return NULL;
    }
    
-   dlclose(handle);
+   _loaded_engines = evas_list_append(_loaded_engines, engine);
+   engine->handle = handle;
    _engine = engine;
    
    return engine;
@@ -630,6 +613,9 @@
 /* Copies the methods of "inherit_from" to "inherit_to" */
 static void _etk_engine_inheritance_set(Etk_Engine *inherit_to, Etk_Engine 
*inherit_from)
 {
+   if (!inherit_to || !inherit_from)
+      return;
+   
    inherit_to->super = inherit_from;
    
    INHERIT(window_constructor);
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_engine.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk_engine.h        27 Jul 2006 16:49:35 -0000      1.2
+++ etk_engine.h        27 Jul 2006 17:22:03 -0000      1.3
@@ -14,6 +14,7 @@
    void *engine_data;
    char *engine_name;
    Etk_Engine *super;
+   void *handle;
    
    void (*window_constructor)(Etk_Window *window);
    void (*window_destructor)(Etk_Window *window);   



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to