Subject: bug#47244: 28.0.50; SIGSEGV in long-runnning Emacs

From: martin rudalics <[email-masked]>
Date: Wed, 24 Mar 2021 07:53:17 +0100

> Okay.  Running with this.

The attached one should make more sense.  Please use that.

 > I still have the other emacs that segfaulted
 > in gdb if you want/need anything else from it.

I think you can close it.

Thanks, martin
diff --git a/lisp/window.el b/lisp/window.el
index cfd9876ed0..7a636bb039 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4686,6 +4686,12 @@ switch-to-prev-buffer
 	(set-window-next-buffers
 	 window (delq buffer (window-next-buffers window)))))

+    (when (and (eq bury-or-kill 'kill)
+               (window-live-p window)
+               (eq (window-buffer window) old-buffer))
+      (error "Could not replace buffer %s in window %s"
+             old-buffer window))
+
     ;; Return new-buffer.
     new-buffer))