[Fontconfig] Re: Crash when non-existing directories are referenced in ~/.fonts.cache

Patrick Lam plam at MIT.EDU
Thu Jan 26 16:31:40 PST 2006


Mike FABIAN wrote:
> The following code in FcConfigNormalizeFontDir ()
> 
>      /* Ok, we didn't find it in fontDirs; let's add subdirs.... */
>      for (n = 0; n < config->fontDirs->num; n++)
>  	FcConfigAddFontDirSubdirs (config, config->fontDirs->strs[n]);
> 
> adds the same subdirectories many times because 
> config->fontDirs->num is getting bigger during the for loop.
> 
> This causes many unnecessary opendir() and readdir() calls.
> 
> I think one should end the for loop when the initial value of
> config->fontDirs->num is reached. All values in the list after the
> initial value of num are newly added subdirectories, there is no
> reason to scan them for subdirectories again.

I've committed my version of this patch and a fix for fc-cache.

In my experience, fc-cache . and fc-cache with a trailing slash work
correctly now.  Let me know if there are any remaining issues.  I'll
also try to test it more myself.

pat


More information about the Fontconfig mailing list