summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-08-25 10:50:59 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-08-25 10:50:59 -0700
commitc436cf693148cf6a9912c605d35ed6566e68bbed (patch)
tree5eb3044f348286db3c1e82ac2c83308600b9f623 /src/modules
parentb6296c6fb4a59bc9e48bac07f6414f0d8fcf1050 (diff)
evas: gl_common should not segv on freeing a NULL gl_image.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c4
-rw-r--r--src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c2
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c9
3 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index cea4b1c..fe8aa5b 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -766,6 +766,8 @@ evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc)
766EAPI void 766EAPI void
767evas_gl_common_image_free(Evas_GL_Image *im) 767evas_gl_common_image_free(Evas_GL_Image *im)
768{ 768{
769 if (!im) return ;
770
769 im->references--; 771 im->references--;
770 if (im->references > 0) return; 772 if (im->references > 0) return;
771 773
@@ -794,7 +796,7 @@ evas_gl_common_image_free(Evas_GL_Image *im)
794 796
795 if (im->cs.data) 797 if (im->cs.data)
796 { 798 {
797 if (!im->cs.no_free) free(im->cs.data); 799 if (!im->cs.no_free) free(im->cs.data);
798 } 800 }
799 if (im->cached) 801 if (im->cached)
800 { 802 {
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c
index 84087a5..2bd9cb3 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_buffer.c
@@ -134,7 +134,7 @@ _evas_ector_gl_buffer_gl_buffer_prepare(Eo *obj, Evas_Ector_GL_Buffer_Data *pd,
134 return; 134 return;
135 135
136on_fail: 136on_fail:
137 if (pd->glim) evas_gl_common_image_free(pd->glim); 137 evas_gl_common_image_free(pd->glim);
138 pd->glim = NULL; 138 pd->glim = NULL;
139} 139}
140 140
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index b437999..2fec3e5 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2172,8 +2172,7 @@ eng_context_clip_image_unset(void *engine EINA_UNUSED, void *context)
2172 RGBA_Draw_Context *ctx = context; 2172 RGBA_Draw_Context *ctx = context;
2173 Evas_GL_Image *im = ctx->clip.mask; 2173 Evas_GL_Image *im = ctx->clip.mask;
2174 2174
2175 if (im) 2175 evas_gl_common_image_free(im);
2176 evas_gl_common_image_free(im);
2177 2176
2178 ctx->clip.mask = NULL; 2177 ctx->clip.mask = NULL;
2179} 2178}
@@ -2584,7 +2583,7 @@ eng_ector_free(void *engine_data)
2584{ 2583{
2585 Evas_GL_Ector *r = engine_data; 2584 Evas_GL_Ector *r = engine_data;
2586 2585
2587 if (r->gl) evas_gl_common_image_free(r->gl); 2586 evas_gl_common_image_free(r->gl);
2588 if (r->tofree) free(r->software); 2587 if (r->tofree) free(r->software);
2589 free(r); 2588 free(r);
2590} 2589}
@@ -2610,7 +2609,7 @@ eng_ector_begin(void *engine, void *context EINA_UNUSED, Ector_Surface *ector,
2610 { 2609 {
2611 int err = EVAS_LOAD_ERROR_NONE; 2610 int err = EVAS_LOAD_ERROR_NONE;
2612 2611
2613 if (buffer->gl) evas_gl_common_image_free(buffer->gl); 2612 evas_gl_common_image_free(buffer->gl);
2614 if (buffer->tofree) free(buffer->software); 2613 if (buffer->tofree) free(buffer->software);
2615 buffer->software = NULL; 2614 buffer->software = NULL;
2616 2615
@@ -2780,7 +2779,7 @@ eng_image_data_unmap(void *engine EINA_UNUSED, void *image, const Eina_Rw_Slice
2780 (map->mode & EFL_GFX_BUFFER_ACCESS_MODE_WRITE)) 2779 (map->mode & EFL_GFX_BUFFER_ACCESS_MODE_WRITE))
2781 evas_gl_common_texture_update(im->tex, im->im); 2780 evas_gl_common_texture_update(im->tex, im->im);
2782 im->maps = eina_inlist_remove(im->maps, EINA_INLIST_GET(map)); 2781 im->maps = eina_inlist_remove(im->maps, EINA_INLIST_GET(map));
2783 if (map->glim) evas_gl_common_image_free(map->glim); 2782 evas_gl_common_image_free(map->glim);
2784 free(map); 2783 free(map);
2785 } 2784 }
2786 return found; 2785 return found;