forked from enlightenment/efl
evas: gl_common should not segv on freeing a NULL gl_image.
This commit is contained in:
parent
b6296c6fb4
commit
c436cf6931
|
@ -766,6 +766,8 @@ evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc)
|
|||
EAPI void
|
||||
evas_gl_common_image_free(Evas_GL_Image *im)
|
||||
{
|
||||
if (!im) return ;
|
||||
|
||||
im->references--;
|
||||
if (im->references > 0) return;
|
||||
|
||||
|
@ -794,7 +796,7 @@ evas_gl_common_image_free(Evas_GL_Image *im)
|
|||
|
||||
if (im->cs.data)
|
||||
{
|
||||
if (!im->cs.no_free) free(im->cs.data);
|
||||
if (!im->cs.no_free) free(im->cs.data);
|
||||
}
|
||||
if (im->cached)
|
||||
{
|
||||
|
|
|
@ -134,7 +134,7 @@ _evas_ector_gl_buffer_gl_buffer_prepare(Eo *obj, Evas_Ector_GL_Buffer_Data *pd,
|
|||
return;
|
||||
|
||||
on_fail:
|
||||
if (pd->glim) evas_gl_common_image_free(pd->glim);
|
||||
evas_gl_common_image_free(pd->glim);
|
||||
pd->glim = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -2172,8 +2172,7 @@ eng_context_clip_image_unset(void *engine EINA_UNUSED, void *context)
|
|||
RGBA_Draw_Context *ctx = context;
|
||||
Evas_GL_Image *im = ctx->clip.mask;
|
||||
|
||||
if (im)
|
||||
evas_gl_common_image_free(im);
|
||||
evas_gl_common_image_free(im);
|
||||
|
||||
ctx->clip.mask = NULL;
|
||||
}
|
||||
|
@ -2584,7 +2583,7 @@ eng_ector_free(void *engine_data)
|
|||
{
|
||||
Evas_GL_Ector *r = engine_data;
|
||||
|
||||
if (r->gl) evas_gl_common_image_free(r->gl);
|
||||
evas_gl_common_image_free(r->gl);
|
||||
if (r->tofree) free(r->software);
|
||||
free(r);
|
||||
}
|
||||
|
@ -2610,7 +2609,7 @@ eng_ector_begin(void *engine, void *context EINA_UNUSED, Ector_Surface *ector,
|
|||
{
|
||||
int err = EVAS_LOAD_ERROR_NONE;
|
||||
|
||||
if (buffer->gl) evas_gl_common_image_free(buffer->gl);
|
||||
evas_gl_common_image_free(buffer->gl);
|
||||
if (buffer->tofree) free(buffer->software);
|
||||
buffer->software = NULL;
|
||||
|
||||
|
@ -2780,7 +2779,7 @@ eng_image_data_unmap(void *engine EINA_UNUSED, void *image, const Eina_Rw_Slice
|
|||
(map->mode & EFL_GFX_BUFFER_ACCESS_MODE_WRITE))
|
||||
evas_gl_common_texture_update(im->tex, im->im);
|
||||
im->maps = eina_inlist_remove(im->maps, EINA_INLIST_GET(map));
|
||||
if (map->glim) evas_gl_common_image_free(map->glim);
|
||||
evas_gl_common_image_free(map->glim);
|
||||
free(map);
|
||||
}
|
||||
return found;
|
||||
|
|
Loading…
Reference in New Issue