Evas GL: Fix crash with dynamic hint set using tbm surface

Summary:
if device support sec_tbm_surface, but doesn't support the EGL_NATIVE_SURFACE_TIZEN
then below api called cause crash!
evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
evas_object_image_alpha_set(o, 0);

1. evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);

 [evas_gl_image.c]
        if (im->im)
          {
             if (evas_cache2_image_cached(&im->im->cache_entry))
               evas_cache2_image_close(&im->im->cache_entry);
             else
               evas_cache_image_drop(&im->im->cache_entry);
             im->im = NULL;  // im->im now NULL!!!
          }

        im->tex = evas_gl_common_texture_dynamic_new(im->gc, im); // im->tex also NULL!!

im->text also NULL!! because If driver does not support the EGL_NATIVE_SURFACE_TIZEN
then below code return NULL at _pool_tex_dynamic_new();

  pt->dyn.img = secsym_eglCreateImage(egldisplay,
                                      EGL_NO_CONTEXT,
                                      EGL_NATIVE_SURFACE_TIZEN,
                                      pt->dyn.buffer, attr);

2. evas_object_image_alpha_set(o, 0);

 [gl_generic/evas_engine.c]
static void * eng_image_alpha_set()
{
  now im->im and im->tex are null so crash happend at eng_image_alpha_set()
}

bug fixed in case of the tbm surface create fails so device cannot support the dynamic hit set,

Test Plan: experdite

Reviewers: jpeg, cedric, spacegrapher

Subscribers: dkdk, scholb.kim, wonsik

Differential Revision: https://phab.enlightenment.org/D3318
This commit is contained in:
Joogab Yun 2015-11-11 14:29:55 +09:00 committed by Jean-Philippe Andre
parent 8f52b2d877
commit 8b1b8d5cf0
1 changed files with 5 additions and 1 deletions

View File

@ -622,6 +622,10 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
}
if (im->content_hint == EVAS_IMAGE_CONTENT_HINT_DYNAMIC)
{
Evas_GL_Texture *tex;
tex = evas_gl_common_texture_dynamic_new(im->gc, im);
if (!tex) return;
if (im->cs.data)
{
if (!im->cs.no_free) free(im->cs.data);
@ -650,7 +654,7 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
evas_gl_common_texture_free(im->tex, EINA_TRUE);
im->tex = NULL;
}
im->tex = evas_gl_common_texture_dynamic_new(im->gc, im);
im->tex = tex;
im->tex_only = 1;
}
else