When BuiltinReadDirectory() is called, it changes the content of the global variable builtin_dir, defined in src/builtins/fonts.c . It actually changes the content of the strings builtin_dir[i].file_name. The culprit is the function FontFileAddFontFile(). The problem is that when the xserver calls BuiltinReadDirectory() twice, because it did a reset for instance, the second call does not read the same set of fonts as the first one, because builtin_dir[i].file_name got changed. So subsquent font lookups might fail. This is what happens in bug https://bugs.freedesktop.org/show_bug.cgi?id=10713 where kdrive exits when a reset happens. Please read comment https://bugs.freedesktop.org/show_bug.cgi?id=10713#c2 attached to that bug.
Created attachment 10748 [details] [review] this patch tries to remove the side effect of the BuiltinReadDirectory() functoin Actually the side effect is not gone. What this patch does is that it saves the content of the builtin_dir and builtin_alias the first time BuiltinReadDirectory() is entered. Subsequent calls to BuiltinReadDirectory() restores the buildin_dir and builtin_alias tables from their copies. I have tested this in kdrive and it seems to work. The copis of builtin_dir and builtin_alias are not freed, but this can be considered as not being a memory leak those copies are allocated only once in the process lifetime.
This should be fixed by commit 7670d4a2720c61fbc7b989fed14c676f04ac3ad1 in libXfont master branch.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.