Subject: Re: bug#17125: Issue still present in pretest 24.3.94.1: in daemon mode, closing X client frame exits entire Emacs

From: Dmitry Antipov <[email-masked]>
Date: Thu, 02 Oct 2014 15:37:35 +0400

On 10/02/2014 02:29 PM, Alexis wrote:

> Breakpoint 1, die (msg=msg@entry=0x664203 "VECTORP (elt)", file=file@entry=0x66b506 "font.c", line=line@entry=2602) at alloc.c:6830
> 6830    {
> (gdb) bt
> #0  die (msg=msg@entry=0x664203 "VECTORP (elt)", file=file@entry=0x66b506 "font.c", line=line@entry=2602) at alloc.c:6830
> #1  0x00000000005b28b1 in font_clear_cache (cache=16514454, driver=driver@entry=0xc7ac80, f=<error reading variable: Unhandled dwarf expression opcode 0xfa>)
>      at font.c:2602
> #2  0x00000000005b9332 in font_finish_cache (driver=0xc7ac80, f=0x129cc28) at font.c:2566

This is an old issue hopefully fixed in trunk (and not in emacs-24 due to an annoying oversight).
Please try this.

Dmitry

=== modified file 'src/font.c'
--- src/font.c	2014-09-16 04:07:51 +0000
+++ src/font.c	2014-10-02 11:09:25 +0000
@@ -2756,22 +2756,21 @@
 	  val = XCDR (val);
 	else
 	  {
-	    Lisp_Object copy;
-
 	    val = driver_list->driver->list (f, scratch_font_spec);
-	    if (NILP (val))
-	      val = zero_vector;
-	    else
-	      val = Fvconcat (1, &val);
-	    copy = copy_font_spec (scratch_font_spec);
-	    ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
-	    XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
+	    if (!NILP (val))
+	      {
+		Lisp_Object copy = copy_font_spec (scratch_font_spec);
+
+		val = Fvconcat (1, &val);
+		ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
+		XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
+	      }
 	  }
-	if (ASIZE (val) > 0
+	if (VECTORP (val) && ASIZE (val) > 0
 	    && (need_filtering
 		|| ! NILP (Vface_ignored_fonts)))
 	  val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size);
-	if (ASIZE (val) > 0)
+	if (VECTORP (val) && ASIZE (val) > 0)
 	  list = Fcons (val, list);
       }
 
@@ -2807,18 +2806,22 @@
 	&& (NILP (ftype) || EQ (driver_list->driver->type, ftype)))
       {
 	Lisp_Object cache = font_get_cache (f, driver_list->driver);
-	Lisp_Object copy;
 
 	ASET (work, FONT_TYPE_INDEX, driver_list->driver->type);
 	entity = assoc_no_quit (work, XCDR (cache));
 	if (CONSP (entity))
-	  entity = XCDR (entity);
+	  entity = AREF (XCDR (entity), 0);
 	else
 	  {
 	    entity = driver_list->driver->match (f, work);
-	    copy = copy_font_spec (work);
-	    ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
-	    XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
+	    if (!NILP (entity))
+	      {
+		Lisp_Object copy = copy_font_spec (work);
+		Lisp_Object match = Fvector (1, &entity);
+
+		ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
+		XSETCDR (cache, Fcons (Fcons (copy, match), XCDR (cache)));
+	      }
 	  }
 	if (! NILP (entity))
 	  break;