evas gl - fix leak with font glyph textures
some font glyphs are still allocated after tyhe last gl window is freed which means we can't make current anymore to free textures after that. this fixes that by flushing gl texture info from the font cache when the last gl windows are gone. @fix
This commit is contained in:
parent
21ee8b8337
commit
af4c3c0fe1
Binary file not shown.
|
@ -68,6 +68,7 @@ EAPI void evas_common_font_flush (void);
|
|||
EAPI void evas_common_font_flush_last (void);
|
||||
EAPI RGBA_Font_Int *evas_common_font_int_find (const char *name, int size, Font_Rend_Flags wanted_rend);
|
||||
EAPI void evas_common_font_all_clear (void);
|
||||
EAPI void evas_common_font_ext_clear (void);
|
||||
|
||||
/* query */
|
||||
|
||||
|
|
|
@ -962,3 +962,60 @@ evas_common_font_int_find(const char *name, int size,
|
|||
eina_stringshare_del(tmp_fn.name);
|
||||
return fi;
|
||||
}
|
||||
|
||||
static void
|
||||
_font_int_ext_clear(RGBA_Font_Int *fi)
|
||||
{
|
||||
RGBA_Font_Glyph *fg;
|
||||
Fash_Glyph_Map *fmap;
|
||||
Fash_Glyph_Map2 *fash2;
|
||||
Fash_Glyph *fash;
|
||||
int i, j, k;
|
||||
|
||||
fash = fi->fash;
|
||||
if (!fash) return;
|
||||
for (k = 0; k <= 0xff; k++)
|
||||
{
|
||||
fash2 = fash->bucket[k];
|
||||
if (fash2)
|
||||
{
|
||||
for (j = 0; j <= 0xff; j++)
|
||||
{
|
||||
fmap = fash2->bucket[j];
|
||||
if (fmap)
|
||||
{
|
||||
for (i = 0; i <= 0xff; i++)
|
||||
{
|
||||
fg = fmap->item[i];
|
||||
if ((fg) && (fg != (void *)(-1)))
|
||||
{
|
||||
if (fg->ext_dat)
|
||||
{
|
||||
if (fg->ext_dat_free)
|
||||
fg->ext_dat_free(fg->ext_dat);
|
||||
fg->ext_dat = NULL;
|
||||
fg->ext_dat_free = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_hash_font_ext(const Eina_Hash *hash EINA_UNUSED,
|
||||
const void *key EINA_UNUSED,
|
||||
void *data EINA_UNUSED,
|
||||
void *fdata EINA_UNUSED)
|
||||
{
|
||||
_font_int_ext_clear(data);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_font_ext_clear(void)
|
||||
{
|
||||
eina_hash_foreach(fonts, _cb_hash_font_ext, NULL);
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@ eng_window_free(Evas_GL_Cocoa_Window *gw)
|
|||
if (gw == _evas_gl_cocoa_window)
|
||||
_evas_gl_cocoa_window = NULL;
|
||||
|
||||
evas_common_font_ext_clear();
|
||||
evas_gl_common_context_free(gw->gl_context);
|
||||
[(EvasGLView*)gw->view release];
|
||||
free(gw);
|
||||
|
|
|
@ -394,6 +394,8 @@ evas_outbuf_free(Outbuf *ob)
|
|||
win_count--;
|
||||
evas_outbuf_use(ob);
|
||||
|
||||
if (win_count == 0) evas_common_font_ext_clear();
|
||||
|
||||
if (ob == _evas_gl_drm_window) _evas_gl_drm_window = NULL;
|
||||
|
||||
if (ob->gl_context)
|
||||
|
|
|
@ -57,6 +57,7 @@ _outbuf_free_region_for_update(Outbuf *ob EINA_UNUSED, RGBA_Image *update EINA_U
|
|||
static void
|
||||
_outbuf_free(Outbuf *ob)
|
||||
{
|
||||
evas_common_font_ext_clear();
|
||||
glsym_evas_gl_common_context_free(ob->gl_context);
|
||||
}
|
||||
|
||||
|
|
|
@ -587,6 +587,8 @@ eng_window_free(Outbuf *gw)
|
|||
win_count--;
|
||||
eng_window_use(gw);
|
||||
|
||||
if (win_count == 0) evas_common_font_ext_clear();
|
||||
|
||||
context = _tls_context_get();
|
||||
xwin = _tls_outbuf_get();
|
||||
|
||||
|
|
Loading…
Reference in New Issue