evas: prevent infinite loop when there is no image we can remove.

This commit is contained in:
Cedric BAIL 2015-04-30 17:12:55 +02:00
parent cb6f13eb6f
commit 28e66c23b6
1 changed files with 5 additions and 1 deletions

View File

@ -55,6 +55,7 @@ _evas_gl_image_cache_trim(Evas_Engine_GL_Context *gc)
{
Evas_GL_Image *im2;
Eina_List *l = NULL;
Eina_Bool removed = EINA_FALSE;
EINA_LIST_REVERSE_FOREACH(gc->shared->images, l, im2)
{
@ -66,11 +67,14 @@ _evas_gl_image_cache_trim(Evas_Engine_GL_Context *gc)
im2->gc->shared->images_size -= (im2->csize);
evas_gl_common_image_free(im2);
l = NULL;
removed = EINA_TRUE;
break;
}
}
if (!gc->shared->images)
if (!removed || !gc->shared->images)
{
ERR("Preventing infinite loop.");
// printf("EEK %i > %i, no imgs\n",
// gc->shared->images_size, size);
break;