evas cache image: compare with cached image file
authorShinwoo Kim <cinoo.kim@samsung.com>
Thu, 23 Aug 2018 05:56:58 +0000 (05:56 +0000)
committerHermet Park <hermetpark@gmail.com>
Wed, 5 Dec 2018 05:51:19 +0000 (14:51 +0900)
commite6697faeab10e4b394c5b34a938512e0bb256539
tree5c2e9c974c644d6a8fcb5f939dd1942f2cbd9f43
parent1e87f4da49fa09781e7ca47e6c05ff626d281f41
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
src/lib/evas/cache/evas_cache_image.c
src/tests/evas/evas_test_image.c