GNU bug report logs - #65198
29.1; Emacs29.1 crash in function face_for_font

Previous Next

Package: emacs;

Reported by: 张云峰 <zhangyunfeng0101 <at> gmail.com>

Date: Thu, 10 Aug 2023 09:58:02 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 65198 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: 张云峰 <zhangyunfeng0101 <at> gmail.com>
Cc: 65198 <at> debbugs.gnu.org
Subject: Re: bug#65198: 29.1; Emacs29.1 crash in function face_for_font
Date: Fri, 11 Aug 2023 18:30:44 +0300
> From: 张云峰 <zhangyunfeng0101 <at> gmail.com>
> Date: Fri, 11 Aug 2023 22:55:29 +0800
> Cc: 65198 <at> debbugs.gnu.org
> 
> (compile emacs without  pgtk)
> 
> (gdb) p it->face_id
> $13 = 0
> (gdb) p it->c
> $14 = 9888
> (gdb) p FRAME_FONT(it->f)
> No symbol "FRAME_FONT" in current context.
> (gdb) p it->f
> $15 = (struct frame *) 0x5555586492e0
> (gdb) p (it->f)->output_data.x->font
> $16 = (struct font *) 0x555558ca8c18

OK.  A new patch (which includes the previous one, so please apply to
the original code):

diff --git a/src/xdisp.c b/src/xdisp.c
index 9cddcfe..830b622 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8312,9 +8312,14 @@ get_next_display_element (struct it *it)
       && success_p
       && FRAME_WINDOW_P (it->f))
     {
-      struct face *face = FACE_FROM_ID (it->f, it->face_id);
+      struct face *face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
 
-      if (it->what == IT_COMPOSITION && it->cmp_it.ch >= 0)
+      if (!face)
+	{
+	  it->what = IT_GLYPHLESS;
+	  it->glyphless_method = GLYPHLESS_DISPLAY_EMPTY_BOX;
+	}
+      else if (it->what == IT_COMPOSITION && it->cmp_it.ch >= 0)
 	{
 	  /* Automatic composition with glyph-string.   */
 	  Lisp_Object gstring = composition_gstring_from_id (it->cmp_it.id);
@@ -31782,8 +31787,8 @@ produce_glyphless_glyph (struct it *it, bool for_no_font, Lisp_Object acronym)
 
   /* Get the metrics of the base font.  We always refer to the current
      ASCII face.  */
-  face = FACE_FROM_ID (it->f, it->face_id)->ascii_face;
-  font = face->font ? face->font : FRAME_FONT (it->f);
+  face = FACE_FROM_ID_OR_NULL (it->f, it->face_id)->ascii_face;
+  font = (face && face->font) ? face->font : FRAME_FONT (it->f);
   normal_char_ascent_descent (font, -1, &it->ascent, &it->descent);
   it->ascent += font->baseline_offset;
   it->descent -= font->baseline_offset;




This bug report was last modified 1 year and 342 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.