Revert "Workaround another race condition issue"
This reverts commit f44bfad235
.
This commit is contained in:
parent
d05d083e9f
commit
d179cbc253
|
@ -587,33 +587,6 @@ FcCacheTimeValid (FcConfig *config, FcCache *cache, struct stat *dir_stat)
|
||||||
return cache->checksum == (int) dir_stat->st_mtime && fnano;
|
return cache->checksum == (int) dir_stat->st_mtime && fnano;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FcBool
|
|
||||||
FcCacheDirsValid (FcConfig *config, FcCache *cache)
|
|
||||||
{
|
|
||||||
FcStrSet *dirs = FcStrSetCreateEx (FCSS_GROW_BY_64);
|
|
||||||
FcBool ret = FcFalse;
|
|
||||||
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
|
|
||||||
FcChar8 *d;
|
|
||||||
|
|
||||||
if (!dirs)
|
|
||||||
goto bail;
|
|
||||||
if (sysroot)
|
|
||||||
d = FcStrBuildFilename (sysroot, FcCacheDir (cache), NULL);
|
|
||||||
else
|
|
||||||
d = FcStrdup (FcCacheDir (cache));
|
|
||||||
if (!FcDirScanOnly (dirs, d, config))
|
|
||||||
goto bail1;
|
|
||||||
ret = cache->dirs_count == dirs->num;
|
|
||||||
if (FcDebug () & FC_DBG_CACHE)
|
|
||||||
printf ("%s: cache: %d, fs: %d\n", d, cache->dirs_count, dirs->num);
|
|
||||||
|
|
||||||
bail1:
|
|
||||||
FcStrSetDestroy (dirs);
|
|
||||||
FcStrFree (d);
|
|
||||||
bail:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map a cache file into memory
|
* Map a cache file into memory
|
||||||
*/
|
*/
|
||||||
|
@ -628,8 +601,7 @@ FcDirCacheMapFd (FcConfig *config, int fd, struct stat *fd_stat, struct stat *di
|
||||||
cache = FcCacheFindByStat (fd_stat);
|
cache = FcCacheFindByStat (fd_stat);
|
||||||
if (cache)
|
if (cache)
|
||||||
{
|
{
|
||||||
if (FcCacheTimeValid (config, cache, dir_stat) &&
|
if (FcCacheTimeValid (config, cache, dir_stat))
|
||||||
FcCacheDirsValid (config, cache))
|
|
||||||
return cache;
|
return cache;
|
||||||
FcDirCacheUnload (cache);
|
FcDirCacheUnload (cache);
|
||||||
cache = NULL;
|
cache = NULL;
|
||||||
|
@ -681,7 +653,6 @@ FcDirCacheMapFd (FcConfig *config, int fd, struct stat *fd_stat, struct stat *di
|
||||||
cache->version < FC_CACHE_VERSION_NUMBER ||
|
cache->version < FC_CACHE_VERSION_NUMBER ||
|
||||||
cache->size != (intptr_t) fd_stat->st_size ||
|
cache->size != (intptr_t) fd_stat->st_size ||
|
||||||
!FcCacheTimeValid (config, cache, dir_stat) ||
|
!FcCacheTimeValid (config, cache, dir_stat) ||
|
||||||
!FcCacheDirsValid (config, cache) ||
|
|
||||||
!FcCacheInsert (cache, fd_stat))
|
!FcCacheInsert (cache, fd_stat))
|
||||||
{
|
{
|
||||||
if (allocated)
|
if (allocated)
|
||||||
|
|
31
src/fcdir.c
31
src/fcdir.c
|
@ -233,8 +233,7 @@ FcDirScanConfig (FcFontSet *set,
|
||||||
FcBlanks *blanks,
|
FcBlanks *blanks,
|
||||||
const FcChar8 *dir,
|
const FcChar8 *dir,
|
||||||
FcBool force, /* XXX unused */
|
FcBool force, /* XXX unused */
|
||||||
FcConfig *config,
|
FcConfig *config)
|
||||||
FcBool scanOnly)
|
|
||||||
{
|
{
|
||||||
DIR *d;
|
DIR *d;
|
||||||
struct dirent *e;
|
struct dirent *e;
|
||||||
|
@ -250,7 +249,7 @@ FcDirScanConfig (FcFontSet *set,
|
||||||
if (!set && !dirs)
|
if (!set && !dirs)
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
|
||||||
if (!blanks && !scanOnly)
|
if (!blanks)
|
||||||
blanks = FcConfigGetBlanks (config);
|
blanks = FcConfigGetBlanks (config);
|
||||||
|
|
||||||
/* freed below */
|
/* freed below */
|
||||||
|
@ -303,17 +302,7 @@ FcDirScanConfig (FcFontSet *set,
|
||||||
* Scan file files to build font patterns
|
* Scan file files to build font patterns
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < files->num; i++)
|
for (i = 0; i < files->num; i++)
|
||||||
{
|
FcFileScanConfig (set, dirs, blanks, files->strs[i], config);
|
||||||
if (scanOnly)
|
|
||||||
{
|
|
||||||
if (FcFileIsDir (files->strs[i]))
|
|
||||||
FcFileScanConfig (NULL, dirs, NULL, files->strs[i], config);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FcFileScanConfig (set, dirs, blanks, files->strs[i], config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bail2:
|
bail2:
|
||||||
FcStrSetDestroy (files);
|
FcStrSetDestroy (files);
|
||||||
|
@ -337,15 +326,7 @@ FcDirScan (FcFontSet *set,
|
||||||
if (cache || !force)
|
if (cache || !force)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
|
||||||
return FcDirScanConfig (set, dirs, blanks, dir, force, FcConfigGetCurrent (), FcFalse);
|
return FcDirScanConfig (set, dirs, blanks, dir, force, FcConfigGetCurrent ());
|
||||||
}
|
|
||||||
|
|
||||||
FcBool
|
|
||||||
FcDirScanOnly (FcStrSet *dirs,
|
|
||||||
const FcChar8 *dir,
|
|
||||||
FcConfig *config)
|
|
||||||
{
|
|
||||||
return FcDirScanConfig (NULL, dirs, NULL, dir, FcTrue, config, FcTrue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -385,7 +366,7 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
|
||||||
/*
|
/*
|
||||||
* Scan the dir
|
* Scan the dir
|
||||||
*/
|
*/
|
||||||
if (!FcDirScanConfig (set, dirs, NULL, d, FcTrue, config, FcFalse))
|
if (!FcDirScanConfig (set, dirs, NULL, d, FcTrue, config))
|
||||||
goto bail2;
|
goto bail2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -440,7 +421,7 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
|
||||||
/*
|
/*
|
||||||
* Scan the dir
|
* Scan the dir
|
||||||
*/
|
*/
|
||||||
if (!FcDirScanConfig (NULL, dirs, NULL, d, FcTrue, config, FcFalse))
|
if (!FcDirScanConfig (NULL, dirs, NULL, d, FcTrue, config))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
/*
|
/*
|
||||||
* Rebuild the cache object
|
* Rebuild the cache object
|
||||||
|
|
|
@ -851,13 +851,7 @@ FcDirScanConfig (FcFontSet *set,
|
||||||
FcBlanks *blanks,
|
FcBlanks *blanks,
|
||||||
const FcChar8 *dir,
|
const FcChar8 *dir,
|
||||||
FcBool force,
|
FcBool force,
|
||||||
FcConfig *config,
|
FcConfig *config);
|
||||||
FcBool scanOnly);
|
|
||||||
|
|
||||||
FcPrivate FcBool
|
|
||||||
FcDirScanOnly (FcStrSet *dirs,
|
|
||||||
const FcChar8 *dir,
|
|
||||||
FcConfig *config);
|
|
||||||
|
|
||||||
/* fcfont.c */
|
/* fcfont.c */
|
||||||
FcPrivate int
|
FcPrivate int
|
||||||
|
|
Loading…
Reference in New Issue