Subject: Re: bug#54028: Window is not a valid window

From: martin rudalics <[email-masked]>
Date: Mon, 21 Feb 2022 10:07:59 +0100

Eli, is the below OK to install on the release branch?  It's a trivial
safety check that would fix this bug.

Thanks, martin

--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6394,7 +6394,8 @@ window-state-put
  	(window--state-put-2 ignore pixelwise))
        (while window-state-put-stale-windows
  	(let ((window (pop window-state-put-stale-windows)))
-	  (when (eq (window-deletable-p window) t)
+	  (when (and (window-valid-p window)
+                     (eq (window-deletable-p window) t))
  	    (delete-window window))))
        (window--check frame))))