Bug 99360 - Fix cache file update on MinGW

On Windows, opened or locked files cannot be removed.
Since fontconfig locked an old cache file while updating the file,
fontconfig failed to replace the file with updated file on Windows.

This patch makes fontconfig does not lock the old cache file
while updating it on Windows.
This commit is contained in:
Masamichi Hosoda 2017-01-11 20:42:56 +09:00 committed by Akira TAGOH
parent 7d949ececd
commit 79058f4e91
1 changed files with 8 additions and 0 deletions

View File

@ -362,7 +362,9 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
if (!dirs) if (!dirs)
goto bail1; goto bail1;
#ifndef _WIN32
fd = FcDirCacheLock (dir, config); fd = FcDirCacheLock (dir, config);
#endif
/* /*
* Scan the dir * Scan the dir
*/ */
@ -382,7 +384,9 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
FcDirCacheWrite (cache, config); FcDirCacheWrite (cache, config);
bail2: bail2:
#ifndef _WIN32
FcDirCacheUnlock (fd); FcDirCacheUnlock (fd);
#endif
FcStrSetDestroy (dirs); FcStrSetDestroy (dirs);
bail1: bail1:
FcFontSetDestroy (set); FcFontSetDestroy (set);
@ -417,7 +421,9 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
if (!dirs) if (!dirs)
goto bail; goto bail;
#ifndef _WIN32
fd = FcDirCacheLock (dir, config); fd = FcDirCacheLock (dir, config);
#endif
/* /*
* Scan the dir * Scan the dir
*/ */
@ -436,7 +442,9 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
FcDirCacheWrite (new, config); FcDirCacheWrite (new, config);
bail1: bail1:
#ifndef _WIN32
FcDirCacheUnlock (fd); FcDirCacheUnlock (fd);
#endif
FcStrSetDestroy (dirs); FcStrSetDestroy (dirs);
bail: bail:
if (d) if (d)