forked from enlightenment/efl
fix memory leak of dirty image
if file was chaned by somebody, it was added to dirty list during cache request. currently this dirty image added to cache->dirty list and never freed until image shutdown. but dirty image of chaned file never used so add delete code for memory efficiency. and fix bad indentation. SVN revision: 67604
This commit is contained in:
parent
4f4a904816
commit
64e2d7fee5
|
@ -42,10 +42,10 @@ static void _evas_cache_image_entry_preload_remove(Image_Entry *ie, const void *
|
|||
|
||||
#define FREESTRC(Var) \
|
||||
if (Var) \
|
||||
{ \
|
||||
{ \
|
||||
eina_stringshare_del(Var); \
|
||||
Var = NULL; \
|
||||
}
|
||||
}
|
||||
|
||||
static void _evas_cache_image_dirty_add(Image_Entry *im);
|
||||
static void _evas_cache_image_dirty_del(Image_Entry *im);
|
||||
|
@ -780,6 +780,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
* of an image at a given key. we wither find it and keep re-reffing
|
||||
* it or we dirty it and get it out */
|
||||
_evas_cache_image_dirty_add(im);
|
||||
/* this image never used, so it have to be deleted */
|
||||
_evas_cache_image_entry_delete(cache, im);
|
||||
im = NULL;
|
||||
}
|
||||
|
||||
|
@ -816,6 +818,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
}
|
||||
/* as avtive cache find - if we match in lru and its invalid, dirty */
|
||||
_evas_cache_image_dirty_add(im);
|
||||
/* this image never used, so it have to be deleted */
|
||||
_evas_cache_image_entry_delete(cache, im);
|
||||
im = NULL;
|
||||
}
|
||||
if (stat_failed) goto on_stat_error;
|
||||
|
@ -830,7 +834,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
if (!im) goto on_stat_error;
|
||||
if (cache->func.debug) cache->func.debug("request", im);
|
||||
|
||||
on_ok:
|
||||
on_ok:
|
||||
*error = EVAS_LOAD_ERROR_NONE;
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
LKL(im->lock_references);
|
||||
|
@ -841,7 +845,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
#endif
|
||||
return im;
|
||||
|
||||
on_stat_error:
|
||||
on_stat_error:
|
||||
#ifndef _WIN32
|
||||
if ((errno == ENOENT) || (errno == ENOTDIR) ||
|
||||
(errno == ENAMETOOLONG) || (errno == ELOOP))
|
||||
|
@ -1145,7 +1149,7 @@ evas_cache_image_size_set(Image_Entry *im, unsigned int w, unsigned int h)
|
|||
if (cache->func.debug) cache->func.debug("size_set", im2);
|
||||
return im2;
|
||||
|
||||
on_error:
|
||||
on_error:
|
||||
if (im2) _evas_cache_image_entry_delete(cache, im2);
|
||||
evas_cache_image_drop(im);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue