GNU bug report logs - #69529
29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer

Previous Next

Package: emacs;

Reported by: brubar.cs <at> gmail.com

Date: Sun, 3 Mar 2024 17:39:01 UTC

Severity: normal

Found in version 29.2

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: brubar.cs <at> gmail.com, Stefan Monnier <monnier <at> iro.umontreal.ca>, martin rudalics <rudalics <at> gmx.at>
Cc: 69529 <at> debbugs.gnu.org
Subject: bug#69529: 29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer
Date: Sun, 03 Mar 2024 21:11:43 +0200
> From: brubar.cs <at> gmail.com
> Date: Sun, 03 Mar 2024 18:37:53 +0100
> 
> Emacs segfaults when evaluating the attached elisp file like this:
> 
>    emacs -Q -l kill-buffer-segfault.el
> 
> It happens to me, both with GNU Emacs 30.0.50 and 29.2.

Stefan and Martin, is the below the right way of avoiding this?

diff --git a/src/buffer.c b/src/buffer.c
index 126f3eb..bccf65f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1971,8 +1971,14 @@ DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ",
       Lisp_Object tail, other;
 
       FOR_EACH_LIVE_BUFFER (tail, other)
-	if (XBUFFER (other)->base_buffer == b)
-	  Fkill_buffer (other);
+	{
+	  if (XBUFFER (other)->base_buffer == b)
+	    {
+	      Fkill_buffer (other);
+	      if (BUFFER_LIVE_P (XBUFFER (other)))
+		error ("Attempt to kill buffer whose indirect buffer cannot be killed");
+	    }
+	}
 
       /* Exit if we now have killed the base buffer (Bug#11665).  */
       if (!BUFFER_LIVE_P (b))




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

Previous Next


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