GNU bug report logs - #79193
31.0.50; feature/igc: crashes with no gui frame

Previous Next

Package: emacs;

Reported by: john muhl <jm <at> pub.pink>

Date: Thu, 7 Aug 2025 17:10:02 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Pip Cet <pipcet <at> protonmail.com>
To: john muhl <jm <at> pub.pink>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>, Helmut Eller <eller.helmut <at> gmail.com>, 79193 <at> debbugs.gnu.org
Subject: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Thu, 07 Aug 2025 17:51:12 +0000
Pip Cet <pipcet <at> protonmail.com> writes:

> "john muhl" <jm <at> pub.pink> writes:

>> (gdb) bt full
>> #0  terminate_due_to_signal (sig=11, backtrace_limit=40) at emacs.c:444
>> No locals.
>> #1  0x000055555589a228 in handle_fatal_signal (sig=11) at sysdep.c:1793
>> No locals.
>> #2  0x000055555589a2b2 in deliver_thread_signal (sig=11, handler=0x55555589a210 <handle_fatal_signal>) at sysdep.c:1785
>>         old_errno = 2
>> #3  0x00005555558959ea in deliver_fatal_thread_signal (sig=11) at sysdep.c:1805
>> No locals.
>> #4  0x000055555589a342 in handle_sigsegv (sig=11, siginfo=0x555555bfb7f0 <sigsegv_stack+62928>, arg=0x555555bfb6c0 <sigsegv_stack+62624>) at sysdep.c:1943
>>         fatal = false
>> #5  <signal handler called>
>> No locals.
>> #6  0x00007ffff57d0327 in __GI_kill () at ../sysdeps/unix/syscall-template.S:120
>> No locals.
>> #7  0x0000555555b5f0f9 in sigHandle ()
>> No symbol table info available.
>> #8  <signal handler called>
>> No locals.
>> #9  0x00005555556ca07a in line_hash_code (f=0x7fff43aae670, row=0x555556059240) at dispnew.c:1196
>>         c = 32
>>         face_id = 0
>>         glyph = 0x55556d380850
>>         end = 0x55556d3820d0
>>         hash = 0
>
> Could you show glyph->frame, f, *glyph->frame, and *f in this stack
> frame?
>
> Is it possible we're simply failing to trace glyph->frame in
> fix_glyph_matrix? Is there some reason those frames should be pinned,
> but might fail to be?

Assuming the answers are "yes" and "no", respectively, I think these two
patches might help:

John, would it be possible for you to keep your current Emacs session
alive in gdb but start a new one with these patches to see whether the
issue still happens?

From 2fb119758582ab202e1691bd14d7545c6cbf948c Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet <at> protonmail.com>
Date: Thu, 7 Aug 2025 17:41:14 +0000
Subject: [PATCH 1/2] [MPS] Fix hashing of text terminal lines (bug#79193)

* src/dispnew.c (line_hash_code) [MPS]: Use 'igc_hash', not the
address of a movable object, as a hash value.
---
 src/dispnew.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/dispnew.c b/src/dispnew.c
index 1eaab64d876..755422b7cf1 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1192,8 +1192,17 @@ line_hash_code (struct frame *f, struct glyph_row *row)
 	     index into the frame's face cache), we need the hash
 	     value to include something specific to the frame, and we
 	     use the frame cache's address for that purpose.  */
+#ifndef HAVE_MPS
 	  if (glyph->frame && glyph->frame != f)
 	    face_id += (uintptr_t) glyph->frame->face_cache;
+#else
+	  if (glyph->frame && glyph->frame != f)
+	    {
+	      Lisp_Object face_cache;
+	      XSETVECTOR (face_cache, glyph->frame->face_cache);
+	      face_id += igc_hash (face_cache);
+	    }
+#endif
 	  if (FRAME_MUST_WRITE_SPACES (f))
 	    c -= SPACEGLYPH;
 	  hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c;
-- 
2.50.0

From 88bd0327b90ba599a31e5ecbb4eabb36c557f7b8 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet <at> protonmail.com>
Date: Thu, 7 Aug 2025 17:42:29 +0000
Subject: [PATCH 2/2] [MPS] Trace frame pointer in glyphs (bug#79193)

* src/igc.c (fix_glyph_pool):
(fix_glyph_matrix): Trace the ->frame pointer in a glyph structure
when fixing the glyph.
---
 src/igc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/igc.c b/src/igc.c
index 765b6a47fb2..966dcb30ac2 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -2282,6 +2282,7 @@ fix_glyph_pool (mps_ss_t ss, struct glyph_pool *pool)
     for (ptrdiff_t i = 0; i < pool->nglyphs; ++i)
       {
 	IGC_FIX12_OBJ (ss, &pool->glyphs[i].object);
+	IGC_FIX12_PVEC (ss, &pool->glyphs[i].frame);
       }
   }
   MPS_SCAN_END (ss);
@@ -2304,7 +2305,10 @@ fix_glyph_matrix (mps_ss_t ss, struct glyph_matrix *matrix)
 	      struct glyph *glyph = row->glyphs[area];
 	      struct glyph *end_glyph = glyph + row->used[area];
 	      for (; glyph < end_glyph; ++glyph)
-		IGC_FIX12_OBJ (ss, &glyph->object);
+		{
+		  IGC_FIX12_OBJ (ss, &glyph->object);
+		  IGC_FIX12_PVEC (ss, &glyph->frame);
+		}
 	    }
 	}
     IGC_FIX12_PVEC (ss, &matrix->buffer);
-- 
2.50.0

Of course, this may fail to work because of the glyph pool tracing bug
Helmut discovered; Helmut, do you have a preference for how to fix that?
My preference would be to simply use igc_xzalloc_ambig, but I also have
code here to make glyph pools, and glyph arrays, special IGC object
types.

Thanks!
Pip





This bug report was last modified 24 days ago.

Previous Next


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