Subject: Re: 25.0.50; build from git crashes on startup

From: Robert Pluim <[email-masked]>
Date: Tue, 03 Apr 2018 11:39:10 +0200

tags 20890 patch

Paul Eggert <[email-masked]> writes:

> Thanks for the bug report.  From the backtrace it appears that
> ftfont_close's implementation incorrectly assumes that ftfont_close
> can't be called from the garbage collector.  I've installed the
> attached FIXME comment and am CC'ing Kenichi Handa, who's an expert in
> ftfont.c.

Following Eli's suggestion in
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30874#88>, Iʼve tested
the following workaround. It works, but it doesnʼt feel like the right
thing to do. However, without it, cairo builds are completely
unusable, and cairo is something we will need to enable by default in
future.

Robert

diff --git i/src/ftfont.c w/src/ftfont.c
index 24a92dd52e..5eda61af0e 100644
--- i/src/ftfont.c
+++ w/src/ftfont.c
@@ -1249,6 +1249,11 @@ ftfont_close (struct font *font)
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   Lisp_Object val, cache;
 
+#ifdef USE_CAIRO
+  /* Bug#20890 workaround.  */
+  if (gc_in_progress)
+    return;
+#endif
   val = Fcons (font->props[FONT_FILE_INDEX], make_number (ftfont_info->index));
   cache = ftfont_lookup_cache (val, FTFONT_CACHE_FOR_FACE);
   eassert (CONSP (cache));