]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid crashes due to base-less indirect buffer
authorEli Zaretskii <eliz@gnu.org>
Mon, 4 Mar 2024 12:59:27 +0000 (14:59 +0200)
committerEshel Yaron <me@eshelyaron.com>
Tue, 5 Mar 2024 15:33:40 +0000 (16:33 +0100)
* src/buffer.c (Fkill_buffer): Prevent killing a buffer if its
indirect buffer refuses to be killed.  (Bug#69529)

(cherry picked from commit 0df3dc3d46fe7848aabb3ca5ff7085ca59799f43)

src/buffer.c

index 126f3eb055ae1d10c835684295c20fad36bbc30b..9f55a8813fac0d340ca7633ffd3c0de8564765ff 100644 (file)
@@ -1971,8 +1971,16 @@ cleaning up all windows currently displaying the buffer to be killed. */)
       Lisp_Object tail, other;
 
       FOR_EACH_LIVE_BUFFER (tail, other)
-       if (XBUFFER (other)->base_buffer == b)
-         Fkill_buffer (other);
+       {
+         struct buffer *obuf = XBUFFER (other);
+         if (obuf->base_buffer == b)
+           {
+             Fkill_buffer (other);
+             if (BUFFER_LIVE_P (obuf))
+               error ("Unable to kill buffer whose indirect buffer `%s' cannot be killed",
+                      SDATA (BVAR (obuf, name)));
+           }
+       }
 
       /* Exit if we now have killed the base buffer (Bug#11665).  */
       if (!BUFFER_LIVE_P (b))