Enlightenment CVS committal
Author : moom
Project : e17
Module : libs/etk
Dir : e17/libs/etk/src/lib
Modified Files:
etk_cache.c
Log Message:
* [Cache] Fix a segv when the cache is full..
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_cache.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etk_cache.c 17 Jan 2007 21:33:39 -0000 1.13
+++ etk_cache.c 17 Jan 2007 21:46:56 -0000 1.14
@@ -160,20 +160,22 @@
Evas_List *l;
if (!cache || !object || cache->size <= 0 || !filename)
- {
- if (cache && object)
- {
- if (cache->free_cb)
- cache->free_cb(object, cache->free_cb_data);
- evas_object_del(object);
- }
return;
- }
/* If the object is already cached, we move it at the end of the cache */
if ((l = evas_object_data_get(object, "_Etk_Cache::Node")))
{
item = l->data;
+ if (item->filename != filename)
+ {
+ free(item->filename);
+ item->filename = strdup(filename);
+ }
+ if (item->key != key)
+ {
+ free(item->key);
+ item->key = strdup(key);
+ }
cache->cached_objects = evas_list_remove_list(cache->cached_objects, l);
cache->cached_objects = evas_list_append(cache->cached_objects, item);
evas_object_data_set(item->object, "_Etk_Cache::Node",
evas_list_last(cache->cached_objects));
@@ -184,13 +186,7 @@
if (evas_list_count(cache->cached_objects) >= cache->size)
{
item = cache->cached_objects->data;
-
evas_object_del(item->object);
- free(item->filename);
- free(item->key);
- free(item);
-
- cache->cached_objects = evas_list_remove_list(cache->cached_objects,
cache->cached_objects);
}
/* We create a new cache-item for the object and we add it to the cache */
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs