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

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

bug#69529: 29.2; Segfault killing base buffer when the indirect buffer r


From: Eli Zaretskii
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@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))





reply via email to

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