A few days ago I was investigating a bug in the EFL WebKit port and
noticed WebKit's and Evas' handling of Fontconfig are somewhat
incompatible: while the evas_font code calls both FcInit() and FcFini()
when on initialization and shutdown, respectively, WebKit keeps some
Fontconfig objects alive until the process exits. In practice, this
means that shutting Evas down will cause FcFini() to assert because
there are objects which have not been properly destroyed.
This is not really a WebKit-specific problem, as any program which also
uses Fontconfig directly and shuts Evas down before destroying all FC
resources it has allocated is going to crash in the same way.
Other libraries such as Qt, Pango and Cairo do not explicitly initialize
and shut Fontconfig down. Evas itself got this code in r40242 and was
later adjusted in r45829 and r74870.
Since we can't completely control the lifetime of all Fontconfig objects
used in client code, I was thinking of doing the same thing as other
libraries do and get rid of the calls to FcInit() and FcFini(). The part
which is really important is not calling FcFini() -- this was already
done for a while in the r45829 which I mentioned. Valgrind will complain
about some "still reachable" memory blocks, but that's not really
important (as raster said in that revision's commit message, "things may
look like they leak in Valgrind - they dont. in reality").
Thoughts?
Index: src/lib/evas/canvas/evas_font_dir.c
===================================================================
--- src/lib/evas/canvas/evas_font_dir.c (revision 83486)
+++ src/lib/evas/canvas/evas_font_dir.c (working copy)
@@ -48,10 +48,6 @@
static void object_text_font_cache_dir_del(char *dir, Evas_Font_Dir *fd);
static int evas_object_text_font_string_parse(char *buffer, char dest[14][256]);
-#ifdef HAVE_FONTCONFIG
-static int fc_init = 0;
-#endif
-
void
evas_font_dir_cache_free(void)
{
@@ -61,23 +57,6 @@
eina_hash_free(font_dirs);
font_dirs = NULL;
}
-
-#ifdef HAVE_FONTCONFIG
- if (fc_init > 0)
- {
- fc_init--;
-/* this is bad i got a:
- * fccache.c:512: FcCacheFini: Assertion fcCacheChains[i] == ((void *)0)' failed.
- *
- * all i can do for now is shut this puppy down. butthat breaks, so disable
- * it as in reality - there is little reason to care about the memory not
- * being freed etc.
- *
- * note 04/08/2012 - this doesnt seem to cause an issue anymore?
- */
- if (fc_init == 0) FcFini();
- }
-#endif
}
const char *
@@ -219,23 +198,7 @@
}
}
-static void
-evas_font_init(void)
-{
- static int done = 0;
- if (done) return;
- done = 1;
#ifdef HAVE_FONTCONFIG
- fc_init++;
- if (fc_init == 1)
- {
- FcInit();
- FcConfigEnableHome(1);
- }
-#endif
-}
-
-#ifdef HAVE_FONTCONFIG
static Evas_Font_Set *
evas_load_fontconfig(Evas *eo_evas, FcFontSet *set, int size,
Font_Rend_Flags wanted_rend)
@@ -519,8 +482,6 @@
if (fdesc->weight == EVAS_FONT_WEIGHT_BOLD)
wanted_rend |= FONT_REND_WEIGHT;
- evas_font_init();
-
EINA_LIST_FOREACH(fonts_cache, l, fd)
{
if (!evas_font_desc_cmp(fdesc, fd->fdesc))
@@ -814,8 +775,6 @@
FcObjectSet *os;
int i;
- evas_font_init();
-
p = FcPatternCreate();
os = FcObjectSetBuild(FC_FAMILY, FC_STYLE, NULL);
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel