unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>, 54028@debbugs.gnu.org
Subject: bug#54028: Window is not a valid window
Date: Thu, 17 Feb 2022 11:06:13 +0100	[thread overview]
Message-ID: <68b4d9be-5e50-a541-9031-787fa7ce3b7c@gmx.at> (raw)
In-Reply-To: <865ypey7bz.fsf@mail.linkov.net>

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

 > I don't know if the author of
 > https://www.reddit.com/r/emacs/comments/sthusa/window_xxx_is_not_a_valid_window_on_switching_tabs/
 > will report the bug here,

Please encourage the author again to report such bugs here.

 > but since it's easily reproducible,
 > here is the short test case, just evaluate this:
 >
 > (window-state-put
 > ...
 >   nil 'safe)
 >
 > It fails with:
 >
 >    Debugger entered--Lisp error: (error "#<window 9> is not a valid window")
 >      error("%s is not a valid window" #<window 9>)
 >      window-normalize-window(#<window 9>)
 >      window-deletable-p(#<window 9>)
 >      window-state-put

I think the attached fixes it, please check.  I have no idea whether the
state is restored as intended, though.

Thanks, martin

[-- Attachment #2: window-state-put.diff --]
[-- Type: text/x-patch, Size: 512 bytes --]

diff --git a/lisp/window.el b/lisp/window.el
index 582600e1c6..38b58712b4 100644
--- 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))))
 

  reply	other threads:[~2022-02-17 10:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 18:50 bug#54028: Window is not a valid window Juri Linkov
2022-02-17 10:06 ` martin rudalics [this message]
2022-02-17 17:34   ` Juri Linkov
2022-02-19  9:38     ` martin rudalics
2022-02-21  9:07   ` martin rudalics
2022-02-21 12:30     ` Eli Zaretskii
2022-02-21 16:50       ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68b4d9be-5e50-a541-9031-787fa7ce3b7c@gmx.at \
    --to=rudalics@gmx.at \
    --cc=54028@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).