summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2018-08-23 05:56:58 +0000
committerCedric BAIL <cedric@osg.samsung.com>2018-11-29 16:01:48 -0800
commit3a89ea15b9d58f195986cb363f421782b0150272 (patch)
treecc2d486e18ea5c6bd90494f3365aefaee8d0e601 /src/lib/evas
parent3f2560a8213d8d4dfc4c7516248fa8cc0712ad49 (diff)
evas cache image: compare with cached image file
As cache2 knows cached image could be not matched even though hash key is not different. Please refer to the following comment of evas_cache2_image_open. /* image we found doesn't match what's on disk (stat info wise) * so dirty the active cache entry so we never find it again. this * also implicitly guarantees that we only have 1 active copy * of an image at a given key. we wither find it and keep re-reffing * it or we dirty it and get it out */ The hash key is created base on the image file address. If the image file address to find does not equal cached image file address then it means that the cached image is no longer valid. This case could happen with the following step. (1) Call evas_object_image_memfile_set with content data A (2) Call evas_object_image_memfile_set with content data B (3) Add timer with short time (ex: 0.01 sec) (4) Delete A image, and add A image in timer callback (5) Delete B image, and add B image in timer callback Sometimes you could see image of A from the B image, because newly created image at step 5 has same address of setp 1. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D6870
Diffstat (limited to 'src/lib/evas')
-rw-r--r--src/lib/evas/cache/evas_cache_image.c46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/lib/evas/cache/evas_cache_image.c b/src/lib/evas/cache/evas_cache_image.c
index 52447df9d0..adc38a86ec 100644
--- a/src/lib/evas/cache/evas_cache_image.c
+++ b/src/lib/evas/cache/evas_cache_image.c
@@ -796,28 +796,42 @@ evas_cache_image_mmap_request(Evas_Cache_Image *cache,
796 /* find image by key in active mmap hash */ 796 /* find image by key in active mmap hash */
797 SLKL(engine_lock); 797 SLKL(engine_lock);
798 im = eina_hash_find(cache->mmap_activ, hkey); 798 im = eina_hash_find(cache->mmap_activ, hkey);
799 if ((im) && (!im->load_failed)) goto on_ok; 799 if (im)
800 else if ((im) && (im->load_failed))
801 { 800 {
802 _evas_cache_image_dirty_add(im); 801 if (im->f != f)
803 im = NULL; 802 {
803 /* as active cache find - if we match in lru and its invalid, dirty */
804 _evas_cache_image_dirty_add(im);
805 /* this image never used, so it have to be deleted */
806 _evas_cache_image_entry_delete(cache, im);
807 im = NULL;
808 }
809 else if (!im->load_failed) goto on_ok;
810 else if (im->load_failed)
811 {
812 _evas_cache_image_dirty_add(im);
813 im = NULL;
814 }
804 } 815 }
805 816
806 /* find image by key in inactive/lru hash */ 817 /* find image by key in inactive/lru hash */
807 im = eina_hash_find(cache->mmap_inactiv, hkey); 818 im = eina_hash_find(cache->mmap_inactiv, hkey);
808 if ((im) && (!im->load_failed)) 819 if (im)
809 {
810 _evas_cache_image_lru_del(im);
811 _evas_cache_image_activ_add(im);
812 goto on_ok;
813 }
814 else if ((im) && (im->load_failed))
815 { 820 {
816 /* as active cache find - if we match in lru and its invalid, dirty */ 821 if (im->f != f)
817 _evas_cache_image_dirty_add(im); 822 {
818 /* this image never used, so it have to be deleted */ 823 /* as active cache find - if we match in lru and its invalid, dirty */
819 _evas_cache_image_entry_delete(cache, im); 824 _evas_cache_image_dirty_add(im);
820 im = NULL; 825 /* this image never used, so it have to be deleted */
826 _evas_cache_image_entry_delete(cache, im);
827 im = NULL;
828 }
829 else if (!im->load_failed)
830 {
831 _evas_cache_image_lru_del(im);
832 _evas_cache_image_activ_add(im);
833 goto on_ok;
834 }
821 } 835 }
822 836
823 im = _evas_cache_image_entry_new(cache, hkey, NULL, f, NULL, key, lo, error); 837 im = _evas_cache_image_entry_new(cache, hkey, NULL, f, NULL, key, lo, error);