evas - image cache - fix loading with skip head on to load changed files

changed files were not being detected as stas was being skipped if
skip head was enabled. this means we totally didnt see changes to
files if loaded this way until caches were cycled/flushed/removed

@fix
This commit is contained in:
Carsten Haitzler 2020-08-30 12:05:17 +01:00
parent 5a125ccfa4
commit 119d9f39dd
1 changed files with 16 additions and 30 deletions

View File

@ -862,7 +862,6 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
size_t key_length;
struct stat st;
Image_Timestamp tstamp;
Eina_Bool skip = lo->skip_head;
Evas_Image_Load_Opts tlo;
if (!file)
@ -885,7 +884,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
size += key_length;
size += _evas_cache_image_loadopts_append(hkey + size, &lo);
tlo = *lo;
tlo.skip_head = skip;
tlo.skip_head = lo->skip_head;
/* find image by key in active hash */
SLKL(engine_lock);
@ -895,15 +894,13 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
int ok = 1;
stat_done = 1;
if (!skip)
if (stat(file, &st) < 0)
{
if (stat(file, &st) < 0)
{
stat_failed = 1;
ok = 0;
}
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
stat_failed = 1;
ok = 0;
}
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
if (ok) goto on_ok;
/* 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
@ -925,20 +922,17 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
{
int ok = 1;
if (!skip)
if (!stat_done)
{
if (!stat_done)
stat_done = 1;
if (stat(file, &st) < 0)
{
stat_done = 1;
if (stat(file, &st) < 0)
{
stat_failed = 1;
stat_failed = 1;
ok = 0;
}
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
}
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
}
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
if (ok)
{
@ -963,21 +957,13 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
}
if (stat_failed) goto on_stat_error;
if (!skip)
if (!stat_done)
{
if (!stat_done)
{
if (stat(file, &st) < 0) goto on_stat_error;
}
_timestamp_build(&tstamp, &st);
im = _evas_cache_image_entry_new(cache, hkey, &tstamp, NULL,
file, key, &tlo, error);
}
else
{
im = _evas_cache_image_entry_new(cache, hkey, NULL, NULL,
file, key, &tlo, error);
if (stat(file, &st) < 0) goto on_stat_error;
}
_timestamp_build(&tstamp, &st);
im = _evas_cache_image_entry_new(cache, hkey, &tstamp, NULL,
file, key, &tlo, error);
if (!im) goto on_stat_error;
if (cache->func.debug) cache->func.debug("request", im);