summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-04-12 12:47:30 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-04-12 12:47:30 +0900
commitaf4c3c0fe134b4684ddf81b2a7f3e409688b99fd (patch)
treea31da58d1721b60ae4552ee38d5dd0af674b1073 /src/lib/evas/common
parent21ee8b83370f0878591106e5625fa2c0a18b4226 (diff)
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
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_font.h1
-rw-r--r--src/lib/evas/common/evas_font_load.c57
2 files changed, 58 insertions, 0 deletions
diff --git a/src/lib/evas/common/evas_font.h b/src/lib/evas/common/evas_font.h
index 5017262..3d59201 100644
--- a/src/lib/evas/common/evas_font.h
+++ b/src/lib/evas/common/evas_font.h
@@ -68,6 +68,7 @@ EAPI void evas_common_font_flush (void);
68EAPI void evas_common_font_flush_last (void); 68EAPI void evas_common_font_flush_last (void);
69EAPI RGBA_Font_Int *evas_common_font_int_find (const char *name, int size, Font_Rend_Flags wanted_rend); 69EAPI RGBA_Font_Int *evas_common_font_int_find (const char *name, int size, Font_Rend_Flags wanted_rend);
70EAPI void evas_common_font_all_clear (void); 70EAPI void evas_common_font_all_clear (void);
71EAPI void evas_common_font_ext_clear (void);
71 72
72/* query */ 73/* query */
73 74
diff --git a/src/lib/evas/common/evas_font_load.c b/src/lib/evas/common/evas_font_load.c
index 041fe00..2afd124 100644
--- a/src/lib/evas/common/evas_font_load.c
+++ b/src/lib/evas/common/evas_font_load.c
@@ -962,3 +962,60 @@ evas_common_font_int_find(const char *name, int size,
962 eina_stringshare_del(tmp_fn.name); 962 eina_stringshare_del(tmp_fn.name);
963 return fi; 963 return fi;
964} 964}
965
966static void
967_font_int_ext_clear(RGBA_Font_Int *fi)
968{
969 RGBA_Font_Glyph *fg;
970 Fash_Glyph_Map *fmap;
971 Fash_Glyph_Map2 *fash2;
972 Fash_Glyph *fash;
973 int i, j, k;
974
975 fash = fi->fash;
976 if (!fash) return;
977 for (k = 0; k <= 0xff; k++)
978 {
979 fash2 = fash->bucket[k];
980 if (fash2)
981 {
982 for (j = 0; j <= 0xff; j++)
983 {
984 fmap = fash2->bucket[j];
985 if (fmap)
986 {
987 for (i = 0; i <= 0xff; i++)
988 {
989 fg = fmap->item[i];
990 if ((fg) && (fg != (void *)(-1)))
991 {
992 if (fg->ext_dat)
993 {
994 if (fg->ext_dat_free)
995 fg->ext_dat_free(fg->ext_dat);
996 fg->ext_dat = NULL;
997 fg->ext_dat_free = NULL;
998 }
999 }
1000 }
1001 }
1002 }
1003 }
1004 }
1005}
1006
1007static Eina_Bool
1008_cb_hash_font_ext(const Eina_Hash *hash EINA_UNUSED,
1009 const void *key EINA_UNUSED,
1010 void *data EINA_UNUSED,
1011 void *fdata EINA_UNUSED)
1012{
1013 _font_int_ext_clear(data);
1014 return EINA_TRUE;
1015}
1016
1017EAPI void
1018evas_common_font_ext_clear(void)
1019{
1020 eina_hash_foreach(fonts, _cb_hash_font_ext, NULL);
1021}