evas gl: Make sure a deleted image can't be the target
authorJean-Philippe Andre <jp.andre@samsung.com>
Thu, 30 Mar 2017 01:26:24 +0000 (10:26 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Fri, 14 Apr 2017 02:26:44 +0000 (11:26 +0900)
If we delete the image that was the target surface for gl
rendering, a crash would occur on the next render cycle.
Unlikely but not impossible to trigger from app side.

@fix

src/modules/evas/engines/gl_common/evas_gl_image.c

index 4a89ff6..d1feacf 100644 (file)
@@ -769,6 +769,9 @@ evas_gl_common_image_free(Evas_GL_Image *im)
    im->references--;
    if (im->references > 0) return;
 
+   if (im->gc && (im->gc->pipe[0].shader.surface == im))
+     evas_gl_common_context_target_surface_set(im->gc, im->gc->def_surface);
+
    if (im->fglyph)
      {
         im->gc->font_glyph_images = eina_list_remove(im->gc->font_glyph_images, im);