unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: 张云峰 <zhangyunfeng0101@gmail.com>
Cc: 65198@debbugs.gnu.org
Subject: bug#65198: 29.1; Emacs29.1 crash in function face_for_font
Date: Fri, 11 Aug 2023 18:30:44 +0300	[thread overview]
Message-ID: <83zg2xfvff.fsf@gnu.org> (raw)
In-Reply-To: <CA+cG9GyE9zUsePR52Fzvm=QqtHJkmAtDUYuuNeT0bMMrxZ_hPA@mail.gmail.com> (message from 张云峰 on Fri, 11 Aug 2023 22:55:29 +0800)

> From: 张云峰 <zhangyunfeng0101@gmail.com>
> Date: Fri, 11 Aug 2023 22:55:29 +0800
> Cc: 65198@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;





  reply	other threads:[~2023-08-11 15:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10  9:57 bug#65198: 29.1; Emacs29.1 crash in function face_for_font 张云峰
2023-08-10 10:06 ` Eli Zaretskii
     [not found]   ` <CA+cG9GxATqwi7-aFEvma0zi3AZM5y6eshU510oPFohuKwhHF4w@mail.gmail.com>
2023-08-10 17:22     ` Eli Zaretskii
2023-08-10 17:58       ` 张云峰
2023-08-10 18:36         ` Eli Zaretskii
2023-08-11  0:15           ` 张云峰
2023-08-11  0:50             ` 张云峰
2023-08-11  6:12               ` Eli Zaretskii
2023-08-11 14:21                 ` 张云峰
2023-08-11 14:55                   ` 张云峰
2023-08-11 15:30                     ` Eli Zaretskii [this message]
2023-08-11 16:14                       ` 张云峰
2023-08-12  6:39                         ` Eli Zaretskii
2023-08-11 15:24                   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83zg2xfvff.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=65198@debbugs.gnu.org \
    --cc=zhangyunfeng0101@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).