Subject: Re: emacs bug #16069 - cause & reproduction

From: nil <[email-masked]>
Date: Sat, 1 Mar 2014 02:36:19 -0800 (PST)

Sorry, shall do.

Xft fonts will be leaked, but that patch does appear to solve the crash; thanks!

(while poking around in font.c I noticed the font cache wasn't being cleared due to a change of structure, something along the lines of the attached seemed to fix it.)
diff --git i/src/font.c w/src/font.c
index 8027de8..5aada83 100644
--- i/src/font.c
+++ w/src/font.c
@@ -2585,18 +2585,21 @@ static void
 font_clear_cache (struct frame *f, Lisp_Object cache, struct font_driver *driver)
 {
   Lisp_Object tail, elt;
-  Lisp_Object tail2, entity;
+  Lisp_Object entity;
+  int i;
 
   /* CACHE = (DRIVER-TYPE NUM-FRAMES FONT-CACHE-DATA ...) */
   for (tail = XCDR (XCDR (cache)); CONSP (tail); tail = XCDR (tail))
     {
       elt = XCAR (tail);
-      /* elt should have the form (FONT-SPEC FONT-ENTITY ...) */
+      /* elt should have the form (FONT-SPEC . [ FONT-ENTITY ...]) */
       if (CONSP (elt) && FONT_SPEC_P (XCAR (elt)))
 	{
-	  for (tail2 = XCDR (elt); CONSP (tail2); tail2 = XCDR (tail2))
+	  elt = XCDR (elt);
+	  eassert (VECTORP (elt));
+	  for (i = 0; i < ASIZE (elt); i++)
 	    {
-	      entity = XCAR (tail2);
+	      entity = AREF (elt, i);
 
 	      if (FONT_ENTITY_P (entity)
 		  && EQ (driver->type, AREF (entity, FONT_TYPE_INDEX)))