evas - gl common - fix drop of image on cache hit in gl engine images

@fix - this fixes a leak (reference count leak)
This commit is contained in:
Carsten Haitzler 2014-07-04 12:26:16 +09:00
parent 84451db638
commit 1eaf26989b
1 changed files with 11 additions and 13 deletions

View File

@ -172,17 +172,15 @@ _evas_gl_common_image(Evas_Engine_GL_Context *gc, RGBA_Image *im_im,
// FIXME: keep unreffed shared images around // FIXME: keep unreffed shared images around
EINA_LIST_FOREACH(gc->shared->images, l, im) EINA_LIST_FOREACH(gc->shared->images, l, im)
{ {
if (im->im == im_im) if (im->im == im_im)
{ {
// why did i put this here? i think to free the rgba pixel data once a texture evas_cache_image_drop(&(im_im->cache_entry));
// exists. gc->shared->images = eina_list_remove_list(gc->shared->images, l);
// evas_cache_image_drop(&(im_im->cache_entry)); gc->shared->images = eina_list_prepend(gc->shared->images, im);
gc->shared->images = eina_list_remove_list(gc->shared->images, l);
gc->shared->images = eina_list_prepend(gc->shared->images, im);
evas_gl_common_image_ref(im); evas_gl_common_image_ref(im);
*error = EVAS_LOAD_ERROR_NONE; *error = EVAS_LOAD_ERROR_NONE;
return im; return im;
} }
} }
im = calloc(1, sizeof(Evas_GL_Image)); im = calloc(1, sizeof(Evas_GL_Image));
@ -194,8 +192,8 @@ _evas_gl_common_image(Evas_Engine_GL_Context *gc, RGBA_Image *im_im,
else else
#endif #endif
evas_cache_image_drop(&(im_im->cache_entry)); evas_cache_image_drop(&(im_im->cache_entry));
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
return NULL; return NULL;
} }
if (im_im->cache_entry.cspaces) if (im_im->cache_entry.cspaces)
{ {