summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2004-02-01 19:32:36 +0000
committerTor Lillqvist <tml@iki.fi>2004-02-01 19:32:36 +0000
commitf4c52909ab5321df608fe7af2da3edcab48818d9 (patch)
tree2fa6634d969c72d83181a6e5932523c21779a263
parentd3481737be37255408025f4b3cf2c8b14a6b2ff7 (diff)
fontconfig, at least as used by GIMP and/or PangoFT2 on Windows, crashes
when trying to save the cache if config->cache is NULL, which happens if FcConfigHome() is NULL. Guard against that by using the temp folder in that case.
-rw-r--r--ChangeLog7
-rw-r--r--src/fccfg.c25
2 files changed, 32 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a3751e9..332844d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-01 Tor Lillqvist <tml@iki.fi>
+
+ * src/fccfg.c (FcConfigCreate): fontconfig, at least as used by
+ GIMP and/or PangoFT2 on Windows, crashes when trying to save the
+ cache if config->cache is NULL, which happens if FcConfigHome() is
+ NULL. Guard against that by using the temp folder in that case.
+
2004-01-03 Roozbeh Pournader <roozbeh@sharif.edu>
* fc-lang/az_ir.orth:
diff --git a/src/fccfg.c b/src/fccfg.c
index f393c79..654977d 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -72,6 +72,31 @@ FcConfigCreate (void)
if (!FcConfigSetCache (config, (FcChar8 *) ("~/" FC_USER_CACHE_FILE)))
goto bail6;
+#ifdef _WIN32
+ if (config->cache == 0)
+ {
+ /* If no home, use the temp folder. */
+ FcChar8 dummy[1];
+ int templen = GetTempPath (1, dummy);
+ FcChar8 *temp = malloc (templen + 1);
+
+ if (temp)
+ {
+ FcChar8 *cache_dir;
+
+ GetTempPath (templen + 1, temp);
+ cache_dir = FcStrPlus (temp, FC_USER_CACHE_FILE);
+ free (temp);
+ if (!FcConfigSetCache (config, cache_dir))
+ {
+ FcStrFree (cache_dir);
+ goto bail6;
+ }
+ FcStrFree (cache_dir);
+ }
+ }
+#endif
+
config->blanks = 0;
config->substPattern = 0;