GNU bug report logs - #77046
31.0.50; Emacs sometimes crashes

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Sun, 16 Mar 2025 09:56:02 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Markus Triska <triska <at> metalevel.at>, Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77046 <at> debbugs.gnu.org
Subject: bug#77046: 31.0.50; Emacs sometimes crashes
Date: Sun, 16 Mar 2025 13:04:46 +0200
> From: Markus Triska <triska <at> metalevel.at>
> Date: Sun, 16 Mar 2025 10:55:35 +0100
> 
> Dear all,
> 
> while trying to reproduce #76186 with "-nw", I sometimes encounter a
> crash. In https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76186#83, Eli
> says this is worth a separate report, and so I am filing it here.
> 
> To try to reproduce the problem, please download the following file:
> 
>     https://www.metalevel.at/ei/recenter_sometimes_not_recentering_nw.el
> 
> and then launch Emacs with:
> 
>     $ emacs -Q -nw --load recenter_sometimes_not_recentering_nw.el
> 
> Leave it running for a while, and then press:
> 
>     C-g C-x C-c
> 
> Sometimes, but not always, this yields:
> 
>     /lib/x86_64-linux-gnu/libc.so.6(+0x28150)[0x7ad890e28150]
>     /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x89)[0x7ad890e28209]
>     emacs(+0x5bab5)[0x57deda682ab5]
>     Segmentation fault (core dumped)
> 
> A backtrace produced by gdb after the crash is encountered follows.

Thanks.  I see a very different backtrace, not sure why.  The problem
I see is fixed with the patch below.  Does it fix the problem for you?

Gerd, any comments for the patch?  I found that
combine_updates_for_frame was trying to combine updates for a
topmost_child frame whose after_make_frame flag was false and whose
desired_matrix was NULL.  That caused a segfault in
make_matrix_current, called from copy_child_glyphs, when make_current
dereferenced the pointer to desired_matrix.  AFAIU, we should not even
try redisplaying such frames.

diff --git a/src/xdisp.c b/src/xdisp.c
index ac65493..d7e0691 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -17569,7 +17569,10 @@ #define AINC(a,i)							\
 	  if (is_tty_frame (f))
 	    {
 	      /* Ignore all invisible tty frames, children or root.  */
-	      if (!frame_redisplay_p (f))
+	      if (!frame_redisplay_p (f)
+		  /* Ignore frames not yet completely made, which we
+		     cannot safely redisplay.  */
+		  || !f->after_make_frame)
 		continue;
 
 	      /* Remember tty root frames which we've seen.  */

> I hope this helps also as a small step towards resolving #76186.

I don't think this is related to the original problem in bug#76186.




This bug report was last modified 84 days ago.

Previous Next


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