Bug 11619 - libxfont BuiltinReadDirectory() has a side effect that is breaking kdrive
Summary: libxfont BuiltinReadDirectory() has a side effect that is breaking kdrive
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xfont (show other bugs)
Version: 7.2 (2007.02)
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: xorg-7.3 10713
  Show dependency treegraph
 
Reported: 2007-07-16 03:14 UTC by Dodji Seketeli
Modified: 2007-08-13 00:48 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
this patch tries to remove the side effect of the BuiltinReadDirectory() functoin (5.04 KB, patch)
2007-07-16 03:33 UTC, Dodji Seketeli
no flags Details | Splinter Review

Description Dodji Seketeli 2007-07-16 03:14:21 UTC
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.
Comment 1 Dodji Seketeli 2007-07-16 03:33:14 UTC
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.
Comment 2 Dodji Seketeli 2007-08-13 00:48:14 UTC
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.