summaryrefslogtreecommitdiff
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
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
-rw-r--r--src/examples/elementary/codegen_example.edjbin12063 -> 0 bytes
-rw-r--r--src/lib/evas/common/evas_font.h1
-rw-r--r--src/lib/evas/common/evas_font_load.c57
-rw-r--r--src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m1
-rw-r--r--src/modules/evas/engines/gl_drm/evas_outbuf.c2
-rw-r--r--src/modules/evas/engines/gl_sdl/evas_engine.c1
-rw-r--r--src/modules/evas/engines/gl_x11/evas_x_main.c2
7 files changed, 64 insertions, 0 deletions
diff --git a/src/examples/elementary/codegen_example.edj b/src/examples/elementary/codegen_example.edj
deleted file mode 100644
index 4f87ec8c82..0000000000
--- a/src/examples/elementary/codegen_example.edj
+++ /dev/null
Binary files differ
diff --git a/src/lib/evas/common/evas_font.h b/src/lib/evas/common/evas_font.h
index 5017262078..3d59201776 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 041fe00029..2afd124941 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}
diff --git a/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m b/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m
index ea29753a43..15dc218d82 100644
--- a/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m
+++ b/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m
@@ -111,6 +111,7 @@ eng_window_free(Evas_GL_Cocoa_Window *gw)
111 if (gw == _evas_gl_cocoa_window) 111 if (gw == _evas_gl_cocoa_window)
112 _evas_gl_cocoa_window = NULL; 112 _evas_gl_cocoa_window = NULL;
113 113
114 evas_common_font_ext_clear();
114 evas_gl_common_context_free(gw->gl_context); 115 evas_gl_common_context_free(gw->gl_context);
115 [(EvasGLView*)gw->view release]; 116 [(EvasGLView*)gw->view release];
116 free(gw); 117 free(gw);
diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c b/src/modules/evas/engines/gl_drm/evas_outbuf.c
index 55d0e2077f..b120216608 100644
--- a/src/modules/evas/engines/gl_drm/evas_outbuf.c
+++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c
@@ -394,6 +394,8 @@ evas_outbuf_free(Outbuf *ob)
394 win_count--; 394 win_count--;
395 evas_outbuf_use(ob); 395 evas_outbuf_use(ob);
396 396
397 if (win_count == 0) evas_common_font_ext_clear();
398
397 if (ob == _evas_gl_drm_window) _evas_gl_drm_window = NULL; 399 if (ob == _evas_gl_drm_window) _evas_gl_drm_window = NULL;
398 400
399 if (ob->gl_context) 401 if (ob->gl_context)
diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c b/src/modules/evas/engines/gl_sdl/evas_engine.c
index 8c70fba4ec..99956ad0ce 100644
--- a/src/modules/evas/engines/gl_sdl/evas_engine.c
+++ b/src/modules/evas/engines/gl_sdl/evas_engine.c
@@ -57,6 +57,7 @@ _outbuf_free_region_for_update(Outbuf *ob EINA_UNUSED, RGBA_Image *update EINA_U
57static void 57static void
58_outbuf_free(Outbuf *ob) 58_outbuf_free(Outbuf *ob)
59{ 59{
60 evas_common_font_ext_clear();
60 glsym_evas_gl_common_context_free(ob->gl_context); 61 glsym_evas_gl_common_context_free(ob->gl_context);
61} 62}
62 63
diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c b/src/modules/evas/engines/gl_x11/evas_x_main.c
index 031f790625..654e384461 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -587,6 +587,8 @@ eng_window_free(Outbuf *gw)
587 win_count--; 587 win_count--;
588 eng_window_use(gw); 588 eng_window_use(gw);
589 589
590 if (win_count == 0) evas_common_font_ext_clear();
591
590 context = _tls_context_get(); 592 context = _tls_context_get();
591 xwin = _tls_outbuf_get(); 593 xwin = _tls_outbuf_get();
592 594