fix font glyph issue when gl enignes shut down leaving font glyph data

for textures in the font core.



SVN revision: 75243
This commit is contained in:
Carsten Haitzler 2012-08-14 08:31:59 +00:00
parent b11b7c3ac4
commit 54650e7e56
4 changed files with 19 additions and 5 deletions

View File

@ -337,6 +337,8 @@ struct _Evas_Engine_GL_Context
Eina_Bool size : 1; Eina_Bool size : 1;
} change; } change;
Eina_List *font_glyph_textures;
Eina_Bool havestuff : 1; Eina_Bool havestuff : 1;
Evas_GL_Image *def_surface; Evas_GL_Image *def_surface;
@ -377,6 +379,7 @@ struct _Evas_GL_Texture
Evas_Engine_GL_Context *gc; Evas_Engine_GL_Context *gc;
Evas_GL_Image *im; Evas_GL_Image *im;
Evas_GL_Texture_Pool *pt, *ptu, *ptv, *ptuv; Evas_GL_Texture_Pool *pt, *ptu, *ptv, *ptuv;
RGBA_Font_Glyph *fglyph;
int x, y, w, h; int x, y, w, h;
double sx1, sy1, sx2, sy2; double sx1, sy1, sx2, sy2;
int references; int references;

View File

@ -771,6 +771,9 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc)
} }
} }
while (gc->font_glyph_textures)
evas_gl_common_texture_free(gc->font_glyph_textures->data);
if ((gc->shared) && (gc->shared->references == 0)) if ((gc->shared) && (gc->shared->references == 0))
{ {
Evas_GL_Texture_Pool *pt; Evas_GL_Texture_Pool *pt;
@ -783,16 +786,18 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc)
evas_gl_common_image_free(gc->shared->images->data); evas_gl_common_image_free(gc->shared->images->data);
} }
EINA_LIST_FOREACH(gc->shared->tex.whole, l, pt)
evas_gl_texture_pool_empty(pt);
for (i = 0; i < 33; i++) for (i = 0; i < 33; i++)
{ {
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
{ {
EINA_LIST_FOREACH(gc->shared->tex.atlas[i][j], l, pt) EINA_LIST_FOREACH(gc->shared->tex.atlas[i][j], l, pt)
evas_gl_texture_pool_empty(pt); evas_gl_texture_pool_empty(pt);
eina_list_free(gc->shared->tex.atlas[i][j]);
} }
} }
EINA_LIST_FOREACH(gc->shared->tex.whole, l, pt)
evas_gl_texture_pool_empty(pt);
eina_list_free(gc->shared->tex.whole);
eina_hash_free(gc->shared->native_pm_hash); eina_hash_free(gc->shared->native_pm_hash);
eina_hash_free(gc->shared->native_tex_hash); eina_hash_free(gc->shared->native_tex_hash);
free(gc->shared); free(gc->shared);

View File

@ -87,6 +87,8 @@ evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg)
tex->sy1 = ((double)(tex->y)) / (double)tex->pt->h; tex->sy1 = ((double)(tex->y)) / (double)tex->pt->h;
tex->sx2 = ((double)(tex->x + tex->w)) / (double)tex->pt->w; tex->sx2 = ((double)(tex->x + tex->w)) / (double)tex->pt->w;
tex->sy2 = ((double)(tex->y + tex->h)) / (double)tex->pt->h; tex->sy2 = ((double)(tex->y + tex->h)) / (double)tex->pt->h;
tex->fglyph = fg;
gc->font_glyph_textures = eina_list_append(gc->font_glyph_textures, tex);
return tex; return tex;
} }

View File

@ -675,9 +675,7 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
pt->fb = 0; pt->fb = 0;
} }
while (pt->allocations) pt->allocations = eina_list_free(pt->allocations);
pt->allocations =
eina_list_remove_list(pt->allocations, pt->allocations);
pt->texture = 0; pt->texture = 0;
pt->gc = NULL; pt->gc = NULL;
pt->w = 0; pt->w = 0;
@ -965,6 +963,12 @@ evas_gl_common_texture_free(Evas_GL_Texture *tex)
if (!tex) return; if (!tex) return;
tex->references--; tex->references--;
if (tex->references != 0) return; if (tex->references != 0) return;
if (tex->fglyph)
{
tex->gc->font_glyph_textures = eina_list_remove(tex->gc->font_glyph_textures, tex);
tex->fglyph->ext_dat = NULL;
tex->fglyph->ext_dat_free = NULL;
}
if (tex->double_buffer.pt[0]) if (tex->double_buffer.pt[0])
{ {
tex->double_buffer.pt[0]->allocations = eina_list_remove(tex->double_buffer.pt[0]->allocations, tex); tex->double_buffer.pt[0]->allocations = eina_list_remove(tex->double_buffer.pt[0]->allocations, tex);