[Fontconfig] Re: fc-cache sometimes looses fonts

Patrick Lam plam at MIT.EDU
Thu Nov 3 02:28:32 EST 2005


sunmoon1997 wrote:
> hi,
>    After updating fontconfig, apps which use fontconfig are going to
> crash:(, then I found FcPatternGetString(pattern, FC_FILE,... only
> returns basename instread of full path name sometimes that make cairo
> return NULL font face then app crashes. Then follow to fontconfig,
> I think problem is here.
> void
> FcPatternDestroy (FcPattern *p)
> {
>     int             i;
> 
>     if (FcPatternFindFullFname (p))
>         FcPatternAddFullFname (p, 0);
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> why every call to FcPatternDestroy want to reset font full name, maybe
> this object is still hold by others.  Removing these two lines,
> everything works fine now.:D

That's quite mysterious.  Oh!  I bet that someone's trying to destroy a 
constant font; the check for constantness is two lines down.  So I bet 
it would work if I moved this two lines down.  But also, there's a 
memory leak here.  I've committed an improved version, which, I believe, 
gets rid of the memory leak as well.

pat



More information about the Fontconfig mailing list