summaryrefslogtreecommitdiff
path: root/src/lib/evas/cache2
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-10-30 14:57:52 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-30 19:48:17 +0900
commit498418bb67c1642d5ccdaa71b393eb57060f1d32 (patch)
tree37a6a7ca351c7c11f82de23c92dff00a9b42265f /src/lib/evas/cache2
parent2b8e74e623c33c1f218f7eec6d3ff6eea2d2b09d (diff)
evas/cserve2: Prevent potential infinite loop (shutdown)
In shutdown, I've encountered an infinite loop. It SHOULD NOT possibly happen, but somehow some image was marked as delete_me=1 but still present in the LRU.
Diffstat (limited to 'src/lib/evas/cache2')
-rw-r--r--src/lib/evas/cache2/evas_cache2.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/lib/evas/cache2/evas_cache2.c b/src/lib/evas/cache2/evas_cache2.c
index 5ec5b6dad0..921d04a364 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -523,26 +523,19 @@ evas_cache2_shutdown(Evas_Cache2 *cache)
523{ 523{
524 Eina_List *delete_list; 524 Eina_List *delete_list;
525 Image_Entry *im; 525 Image_Entry *im;
526 Eina_Inlist *il;
527
528 EINA_INLIST_FOREACH_SAFE(cache->lru, il, im)
529 _evas_cache2_image_entry_delete(cache, im);
526 530
527 while (cache->lru)
528 {
529 im = (Image_Entry *)cache->lru;
530 _evas_cache2_image_entry_delete(cache, im);
531 }
532 /* This is mad, I am about to destroy image still alive, but we need to prevent leak. */ 531 /* This is mad, I am about to destroy image still alive, but we need to prevent leak. */
533 while (cache->dirty) 532 EINA_INLIST_FOREACH_SAFE(cache->dirty, il, im)
534 { 533 _evas_cache2_image_entry_delete(cache, im);
535 im = (Image_Entry *)cache->dirty;
536 _evas_cache2_image_entry_delete(cache, im);
537 }
538 534
539 delete_list = NULL; 535 delete_list = NULL;
540 eina_hash_foreach(cache->activ, _evas_cache2_image_free_cb, &delete_list); 536 eina_hash_foreach(cache->activ, _evas_cache2_image_free_cb, &delete_list);
541 while (delete_list) 537 EINA_LIST_FREE(delete_list, im)
542 { 538 _evas_cache2_image_entry_delete(cache, im);
543 _evas_cache2_image_entry_delete(cache, eina_list_data_get(delete_list));
544 delete_list = eina_list_remove_list(delete_list, delete_list);
545 }
546 539
547 eina_hash_free(cache->activ); 540 eina_hash_free(cache->activ);
548 eina_hash_free(cache->inactiv); 541 eina_hash_free(cache->inactiv);