if (im->flags.given_mmap)
{
eina_hash_direct_add(im->cache->mmap_inactiv, im->cache_key, im);
- im->cache->mmap_lru = eina_inlist_prepend(im->cache->mmap_lru, EINA_INLIST_GET(im));
}
else
{
eina_hash_direct_add(im->cache->inactiv, im->cache_key, im);
- im->cache->lru = eina_inlist_prepend(im->cache->lru, EINA_INLIST_GET(im));
}
+ im->cache->lru = eina_inlist_prepend(im->cache->lru, EINA_INLIST_GET(im));
im->cache->usage += im->cache->func.mem_size_get(im);
}
if (im->flags.given_mmap)
{
eina_hash_del(im->cache->mmap_inactiv, im->cache_key, im);
- im->cache->mmap_lru = eina_inlist_remove(im->cache->mmap_lru, EINA_INLIST_GET(im));
}
else
{
eina_hash_del(im->cache->inactiv, im->cache_key, im);
- im->cache->lru = eina_inlist_remove(im->cache->lru, EINA_INLIST_GET(im));
}
+ im->cache->lru = eina_inlist_remove(im->cache->lru, EINA_INLIST_GET(im));
im->cache->usage -= im->cache->func.mem_size_get(im);
}
_evas_cache_image_lru_del(im);
im->flags.lru = 1;
im->flags.cached = 1;
- if (im->flags.given_mmap)
- im->cache->mmap_lru_nodata = eina_inlist_prepend(im->cache->mmap_lru_nodata, EINA_INLIST_GET(im));
- else
- im->cache->lru_nodata = eina_inlist_prepend(im->cache->lru_nodata, EINA_INLIST_GET(im));
+ im->cache->lru_nodata = eina_inlist_prepend(im->cache->lru_nodata, EINA_INLIST_GET(im));
}
static void
if (!im->flags.lru_nodata) return;
im->flags.lru = 0;
im->flags.cached = 0;
- if (im->flags.given_mmap)
- im->cache->mmap_lru_nodata = eina_inlist_remove(im->cache->mmap_lru_nodata, EINA_INLIST_GET(im));
- else
- im->cache->lru_nodata = eina_inlist_remove(im->cache->lru_nodata, EINA_INLIST_GET(im));
+ im->cache->lru_nodata = eina_inlist_remove(im->cache->lru_nodata, EINA_INLIST_GET(im));
}
static void
{
Image_Entry_Task *task;
+ fprintf(stderr, "delete entry %p %p\n", ie, ie->f);
if (!ie) return;
if ((cache) && (cache->func.debug)) cache->func.debug("deleting", ie);
if (ie->flags.delete_me == 1) return;
FREESTRC(ie->cache_key);
FREESTRC(ie->file);
FREESTRC(ie->key);
+ if (ie->f && ie->flags.given_mmap) eina_file_close(ie->f);
ie->cache = NULL;
cache->func.surface_delete(ie);
ie->w = -1;
ie->h = -1;
ie->scale = 1;
- ie->f = f;
+ ie->f = eina_file_dup(f);
ie->loader_data = NULL;
if (ie->f) ie->flags.given_mmap = EINA_TRUE;
if (file) ie->file = eina_stringshare_add(file);
_evas_cache_image_entry_delete(cache, im);
EINA_INLIST_FREE(cache->lru_nodata, im)
_evas_cache_image_entry_delete(cache, im);
- EINA_INLIST_FREE(cache->mmap_lru, im)
- _evas_cache_image_entry_delete(cache, im);
- EINA_INLIST_FREE(cache->mmap_lru_nodata, im)
- _evas_cache_image_entry_delete(cache, im);
/* This is mad, I am about to destroy image still alive, but we need to prevent leak. */
while (cache->dirty)
if (!im) return NULL;
on_ok:
+ fprintf(stderr, "new ref: %i\n", im->references);
*error = EVAS_LOAD_ERROR_NONE;
im->references++;
return im;
cache = im->cache;
+ fprintf(stderr, "%p ref: %i, im->f: %p, cache: %p\n",
+ im, references, im->f, cache);
if (references == 0)
{
if (im->preload)