Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/lib/engines/common


Modified Files:
        evas_image_load.c evas_image_main.c evas_image_save.c 


Log Message:


and i implemented module UNLOADING. given enough cycles of non-use of a
module and no references, it will get.... UNLOADED :)

===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_image_load.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- evas_image_load.c   6 Sep 2006 07:33:40 -0000       1.34
+++ evas_image_load.c   18 Sep 2006 09:40:28 -0000      1.35
@@ -11,6 +11,7 @@
    RGBA_Image *im;
    char *p;
    char *loader = NULL;
+   Evas_Module *em;
 
    if (file == NULL) return NULL;
 
@@ -50,13 +51,12 @@
      }
    if (loader)
      {
-        Evas_Module *em;
-       
        em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
        if (em)
          {
             if (evas_module_load(em))
               {
+                 evas_module_use(em);
                  evas_image_load_func = em->functions;
                  if (evas_image_load_func->file_head(im, file, key))
                    goto ok;
@@ -66,12 +66,11 @@
 
    for (l = evas_modules; l; l = l->next)
      {
-        Evas_Module *em;
-
        em = l->data;
        if (em->type != EVAS_MODULE_TYPE_IMAGE_LOADER) continue;
        if (!evas_module_load(em)) continue;
         evas_image_load_func = em->functions;
+       evas_module_use(em);
        if (evas_image_load_func->file_head(im, file, key))
          {
             if (evas_modules != l)
@@ -86,9 +85,11 @@
    return NULL;
    ok:
 
+   im->info.module = (void *)em;
    im->info.loader = (void *)evas_image_load_func;
    im->info.file = (char *)evas_stringshare_add(file);
    if (key) im->info.key = (char *)evas_stringshare_add(key);
+   evas_module_ref((Evas_Module *)im->info.module);
    evas_common_image_ref(im);
    return im;
 }
@@ -101,6 +102,7 @@
    if (im->image->data) return;
 
    evas_image_load_func = im->info.loader;
+   evas_module_use((Evas_Module *)im->info.module);
    if (!evas_image_load_func->file_data(im, im->info.file, im->info.key))
      {
        evas_common_image_surface_alloc(im->image);
@@ -113,5 +115,10 @@
             im->image->data = (DATA32 *)&pixel;
             im->image->no_free = 1;
          }
+     }
+   else
+     {
+       evas_module_unref((Evas_Module *)im->info.module);
+       im->info.module = NULL;
      }
 }
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_image_main.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- evas_image_main.c   6 Sep 2006 07:33:40 -0000       1.34
+++ evas_image_main.c   18 Sep 2006 09:40:29 -0000      1.35
@@ -268,6 +268,7 @@
 //   if (im->info.real_file) evas_stringshare_del(im->info.real_file);
    if (im->info.key) evas_stringshare_del(im->info.key);
 //   if (im->info.comment) evas_stringshare_del(im->info.comment);
+   if (im->info.module) evas_module_unref((Evas_Module *)im->info.module);
    free(im);
 }
 
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_image_save.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- evas_image_save.c   15 Jan 2006 10:44:48 -0000      1.5
+++ evas_image_save.c   18 Sep 2006 09:40:29 -0000      1.6
@@ -38,6 +38,7 @@
        em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_SAVER, saver);
        if (em)
          {
+            evas_module_use(em);
             if (evas_module_load(em))
               {
                  evas_image_save_func = em->functions;



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to