From: barbieri Date: Fri, 23 Jan 2009 21:08:35 +0000 (+0000) Subject: Fix image cache shutdown. X-Git-Tag: 2.0_alpha~240^2~2619 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16521142659b4f79279a109731b87afe9c6352cb;p=framework%2Fuifw%2Fevas.git Fix image cache shutdown. we should just remove entries pending preload from the cache being shutdown, not all of them. this is untested as it is hard to force this situation, but should be more correct than the previous. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@38747 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/cache/evas_cache_image.c b/src/lib/cache/evas_cache_image.c index 89aabfa..d2d155d 100644 --- a/src/lib/cache/evas_cache_image.c +++ b/src/lib/cache/evas_cache_image.c @@ -499,6 +499,21 @@ _evas_cache_image_free_cb(__UNUSED__ const Eina_Hash *hash, __UNUSED__ const voi return 1; } +#ifdef BUILD_ASYNC_PRELOAD +static void +_evas_cache_image_entry_clear_preloaders(Image_Entry *ie) +{ + while (ie->targets) + { + Evas_Cache_Target *t = ie->targets; + ie->targets = (Evas_Cache_Target *) + eina_inlist_remove(EINA_INLIST_GET(ie->targets), + EINA_INLIST_GET(ie->targets)); + free(t); + } +} +#endif + EAPI void evas_cache_image_shutdown(Evas_Cache_Image *cache) { @@ -515,22 +530,20 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache) pthread_mutex_lock(&mutex); if (running) { - while (preload) + Eina_Inlist *l, *l_next; + for (l = preload; l != NULL; l = l_next) { - Evas_Cache_Preload *tmp = (Evas_Cache_Preload *)preload; + Evas_Cache_Preload *tmp = (Evas_Cache_Preload *)l; Image_Entry *ie = tmp->ie; - while (ie->targets) - { - Evas_Cache_Target *t = ie->targets; - ie->targets = (Evas_Cache_Target *) - eina_inlist_remove(EINA_INLIST_GET(ie->targets), - EINA_INLIST_GET(ie->targets)); - free(t); - } + l_next = l->next; - preload = eina_inlist_remove(preload, preload); - free(tmp); + if (ie->cache != cache) + continue; + + preload = eina_inlist_remove(preload, l); + _evas_cache_image_entry_clear_preloaders(ie); + free(l); } } pthread_mutex_unlock(&mutex);