evas/gl_x11, gl_cocoa: remove static variable in eng_font_draw

Summary:
When evas is recreated, this static variable value remains,
so it references already freed memory.

Test Plan: Local tests

Reviewers: cedric, jpeg

Reviewed By: jpeg

Subscribers: wonsik, mer.kim, cedric

Differential Revision: https://phab.enlightenment.org/D2678
This commit is contained in:
Dongyeon Kim 2015-06-15 17:48:10 +09:00 committed by Jean-Philippe Andre
parent f24b45a7d0
commit 291fcca181
4 changed files with 25 additions and 25 deletions

View File

@ -1035,27 +1035,25 @@ eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font EINA
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
re->win->gl_context->dc = context;
{
// FIXME: put im into context so we can free it
static RGBA_Image *im = NULL;
if (!im)
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
im->cache_entry.w = re->win->gl_context->shared->w;
im->cache_entry.h = re->win->gl_context->shared->h;
if (!re->win->gl_context->font_surface)
re->win->gl_context->font_surface = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
re->win->gl_context->font_surface->cache_entry.w = re->win->gl_context->shared->w;
re->win->gl_context->font_surface->cache_entry.h = re->win->gl_context->shared->h;
evas_common_draw_context_font_ext_set(context,
re->win->gl_context,
evas_gl_font_texture_new,
evas_gl_font_texture_free,
evas_gl_font_texture_draw,
re->win->gl_context,
evas_gl_font_texture_new,
evas_gl_font_texture_free,
evas_gl_font_texture_draw,
NULL,
NULL,
NULL);
evas_common_font_draw_prepare(intl_props);
evas_common_font_draw(im, context, x, y, intl_props->glyphs);
evas_common_draw_context_font_ext_set(context,
NULL,
NULL,
NULL,
evas_common_font_draw_prepare(intl_props);
evas_common_font_draw(re->win->gl_context->font_surface, context, x, y, intl_props->glyphs);
evas_common_draw_context_font_ext_set(context,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,

View File

@ -579,6 +579,8 @@ struct _Evas_Engine_GL_Context
GLuint preserve_bit;
int gles_version;
RGBA_Image *font_surface;
};
struct _Evas_GL_Texture_Pool

View File

@ -973,6 +973,9 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc)
if (gc->def_surface) evas_gl_common_image_free(gc->def_surface);
if (gc->font_surface)
evas_cache_image_drop(&gc->font_surface->cache_entry);
if (glsym_glMapBuffer && glsym_glUnmapBuffer)
{
for (i = 0; i < MAX_PIPES; i++)

View File

@ -1335,13 +1335,10 @@ eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font EINA
evas_gl_common_context_target_surface_set(gl_context, surface);
gl_context->dc = context;
{
// FIXME: put im into context so we can free it
static RGBA_Image *im = NULL;
if (!im)
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
im->cache_entry.w = gl_context->shared->w;
im->cache_entry.h = gl_context->shared->h;
if (!gl_context->font_surface)
gl_context->font_surface = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
gl_context->font_surface->cache_entry.w = gl_context->shared->w;
gl_context->font_surface->cache_entry.h = gl_context->shared->h;
evas_common_draw_context_font_ext_set(context,
gl_context,
@ -1352,7 +1349,7 @@ eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font EINA
evas_gl_image_free,
evas_gl_image_draw);
evas_common_font_draw_prepare(intl_props);
evas_common_font_draw(im, context, x, y, intl_props->glyphs);
evas_common_font_draw(gl_context->font_surface, context, x, y, intl_props->glyphs);
evas_common_draw_context_font_ext_set(context,
NULL,
NULL,