bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65198: 29.1; Emacs29.1 crash in function face_for_font


From: 张云峰
Subject: bug#65198: 29.1; Emacs29.1 crash in function face_for_font
Date: Sat, 12 Aug 2023 00:14:01 +0800

I made a little modification to this patch, and after verification, emacs does not crash anymore, thanks!😊

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);
+   if (face) 
+   {
+      face = face->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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]