Subject: Re: bug#11850: crash (null font) running emacs built from git

From: Eli Zaretskii <[email-masked]>
Date: Wed, 04 Jul 2012 19:32:01 +0300

> Date: Wed, 4 Jul 2012 17:31:38 +0300
> From: Yotam Medini יותם מדיני <[email-masked]>
> Cc: [email-masked]
> 
> With the patch it still crashes immediately (on my office LinuxMint).
> But in a 'later' place. See following gdb-log:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x080feb2f in x_draw_glyphless_glyph_string_foreground (s=0xbfffd230)
>     at xterm.c:1420
> (gdb) where
> #0  0x080feb2f in x_draw_glyphless_glyph_string_foreground (s=0xbfffd230)
>     at xterm.c:1420

As expected.

Next, please apply the patch below, and tell me whether one of the
assertions I've added catches our villain.  If it does, please show
the backtrace.

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2012-06-29 18:52:54 +0000
+++ src/xdisp.c	2012-07-04 16:26:22 +0000
@@ -22508,6 +22508,7 @@ fill_composite_glyph_string (struct glyp
       s->font_not_found_p = 1;
       s->font = FRAME_FONT (s->f);
     }
+  eassert (s->font);
 
   /* Adjust base line for subscript/superscript text.  */
   s->ybase += s->first_glyph->voffset;
@@ -22535,6 +22536,7 @@ fill_gstring_glyph_string (struct glyph_
   s->face = FACE_FROM_ID (s->f, face_id);
   lgstring = composition_gstring_from_id (s->cmp_id);
   s->font = XFONT_OBJECT (LGSTRING_FONT (lgstring));
+  eassert (s->font);
   glyph++;
   while (glyph < last
 	 && glyph->u.cmp.automatic
@@ -22573,6 +22575,7 @@ fill_glyphless_glyph_string (struct glyp
   voffset = glyph->voffset;
   s->face = FACE_FROM_ID (s->f, face_id);
   s->font = s->face->font;
+  eassert (s->font);
   s->nchars = 1;
   s->width = glyph->pixel_width;
   glyph++;
@@ -22654,6 +22657,7 @@ fill_glyph_string (struct glyph_string *
   s->ybase += voffset;
 
   eassert (s->face && s->face->gc);
+  eassert (s->font);
   return glyph - s->row->glyphs[s->area];
 }
 
@@ -22669,6 +22673,7 @@ fill_image_glyph_string (struct glyph_st
   s->slice = s->first_glyph->slice.img;
   s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
   s->font = s->face->font;
+  eassert (s->font);
   s->width = s->first_glyph->pixel_width;
 
   /* Adjust base line for subscript/superscript text.  */
@@ -22696,6 +22701,7 @@ fill_stretch_glyph_string (struct glyph_
   face_id = glyph->face_id;
   s->face = FACE_FROM_ID (s->f, face_id);
   s->font = s->face->font;
+  eassert (s->font);
   s->width = glyph->pixel_width;
   s->nchars = 1;
   voffset = glyph->voffset;