GNU bug report logs - #49248
28.0.50; read-from-minibuffer returns a window-live-p error when its original window is deleted

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thievol <at> posteo.net>

Date: Mon, 28 Jun 2021 06:53:02 UTC

Severity: normal

Found in version 28.0.50

Full log


Message #17 received at 49248 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: thievol <at> posteo.net, 49248 <at> debbugs.gnu.org
Subject: Re: bug#49248: 28.0.50;
 read-from-minibuffer returns a window-live-p error when its original
 window is deleted
Date: Thu, 01 Jul 2021 12:21:03 +0300
> From: martin rudalics <rudalics <at> gmx.at>
> Date: Tue, 29 Jun 2021 10:03:11 +0200
> Cc: 49248 <at> debbugs.gnu.org
> 
> Apparently, exiting from the minibuffer may select a frame no less
> than four times here:
> 
> #1 in read_minibuf_unwind
>    if (!EQ (exp_MB_frame, saved_selected_frame)
>        && !NILP (exp_MB_frame))
>      do_switch_frame (exp_MB_frame, 0, 0, Qt); /* This also sets
> 					     minibuf_window */
> 
> #2 in read_minibuf_unwind
>        else if (WINDOW_LIVE_P (calling_window))
> 	Fset_frame_selected_window (calling_frame, calling_window, Qnil);
> 
> #3 in read_minibuf_unwind
>    /* Restore the selected frame. */
>    if (!EQ (exp_MB_frame, saved_selected_frame)
>        && !NILP (exp_MB_frame))
>      do_switch_frame (saved_selected_frame, 0, 0, Qt);
> 
> #4 in read_minibuf
>    if (FRAMEP (calling_frame)
>        && FRAME_LIVE_P (XFRAME (calling_frame))
>        && (!EQ (selected_frame, calling_frame)
> 	  || (WINDOW_LIVE_P (XFRAME (calling_frame)->minibuffer_window)
> 	      && !EQ (XWINDOW (XFRAME (calling_frame)->minibuffer_window)
> 		      ->frame,
> 		      calling_frame))))
>      call2 (Qselect_frame_set_input_focus, calling_frame, Qnil);
> 
> These will confuse the hell out of any window manager (and of me).  Can
> some knowledgeable soul tell us what all this code is supposed to do and
> whether it could be refactored in some sane way?

#1 and #3 are identical, so I think we could avoid #3 by testing the
selected frame against saved_selected_frame.

#2 is only done if "the previous minibuffer displayed in this miniwindow is
dead", so I don't see a problem there.

#4 is only done if read_minibuf_unwind didn't already do it, for
whatever reason, so it's just the code trying to be defensive.
(read_minibuf_unwind must re-select the original frame in case we QUIT
or signal an error during read_minibuf.)

HTH




This bug report was last modified 4 years and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.