> -----Original Message----- > From: fontconfig-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:fontconfig- > bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Diego Santa Cruz > > I am testing my proposed fix and will let you know how it goes shortly. > Please find attached my proposed fix. As far as I could test it does work as intended. However, we have hit two more problems once fontconfig realizes that the cache file is outdated and builds a new one. 1. When fontconfig builds a cache it inserts it into the cache chain with cache_dev, cache_ino and cache_mtime all set to zero, since the cache is not yet on disk. However, when the cache is finally written to disk by FcDirCacheWrite() the fields in the cache chain are not updated. The effect is that any later FcCacheFindByStat() on the same font directory will fail because the cache_{dev,ino,mtime} cannot match, resulting in reloading yet again the cache files. Would doing a stat just before FcAtomicReplaceOrig() and inserting these fields into the cache chain if FcAtomicReplaceOrig() succeeds be OK? 2. Under Windows the FcAtomicReplaceOrig() always fails if the cache file is loaded somewhere. In fact, unlink and rename fail if the (old) file is mmaped by someone (which often is the same app). I think that, under Windows, if unlink() fails we should try to rename the old file to some other name, and then rename the new cache file to the correct cache name. Note that under Windows an open or mmaped file can be renamed, at least within the same directory. This however runs the risk of leaving files behind, but well its Windows... Any other ideas? Sincerely, Diego -- Diego Santa Cruz, PhD Technology Architect _________________________________ SpinetiX S.A. Rue des Terreaux 17 1003, Lausanne, Switzerland T +41 21 341 15 50 F +41 21 311 19 56 diego.santacruz@xxxxxxxxxxxx http://www.spinetix.com _________________________________
Attachment:
fccache-valid-mtime.patch
Description: fccache-valid-mtime.patch
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig