unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: enometh@meer.net, 39977@debbugs.gnu.org
Subject: bug#39977: 28.0.50; Unhelpful stack trace
Date: Sun, 15 Mar 2020 18:49:21 +0100	[thread overview]
Message-ID: <3ac189d0-5d05-fdf9-0922-0c464b1b17c3@gmx.at> (raw)
In-Reply-To: <83y2s2bswl.fsf@gnu.org>

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

 > And what do you suggest to do if the frame at RHS is not live?

Sorry, what is RHS?  As far as xdisp.c is concerned it simply must not
set selected_frame to a dead frame.  Never ever.  As far as frame.c is
concerned, it should do something like in the attached patch.  In the
worst case this might make it impossible to remove a specific frame but
this can usually be fixed by C-x 5 2 followed by C-x 5 1 unless things
are awfully broken.  But at least this is a place from where to continue
investigating.  I have no better idea.

 >> I have no idea whether these could help in any way but since we are in
 >> redisplay and the selected frame has become dead all of a sudden ...
 >
 > Why do you think this is a problem for redisplay?

I didn't say that this is a problem for redisplay.  What I wanted to say
is that your fix which is supposed to handle a (maybe only temporary)
problem inside redisplay might cause more serious problems when
selecting a dead frame outside of redisplay.  But maybe I'm confusing
things.

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: frame.c.diff --]
[-- Type: text/x-patch; name="frame.c.diff", Size: 1578 bytes --]

diff --git a/src/frame.c b/src/frame.c
index 88d6f22fc0..ef42f230ef 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1466,6 +1466,11 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
       tty->top_frame = frame;
     }

+  if (!FRAME_LIVE_P (f))
+    /* Return nil if for some reason FRAME has become dead now
+       (Bug#39977).  */
+    return Qnil;
+
   selected_frame = frame;
   if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame)))
     last_nonminibuf_frame = XFRAME (selected_frame);
@@ -2009,8 +2014,6 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
 	error ("Attempt to delete the only frame");
     }

-  /* At this point, we are committed to deleting the frame.
-     There is no more chance for errors to prevent it.  */
   minibuffer_selected = EQ (minibuf_window, selected_window);
   sf = SELECTED_FRAME ();
   /* Don't let the frame remain selected.  */
@@ -2066,10 +2069,17 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
 	Fraise_frame (frame1);
 #endif

-      do_switch_frame (frame1, 0, 1, Qnil);
+      if (!EQ (do_switch_frame (frame1, 0, 1, Qnil), frame1))
+	/* Error out if for some reason FRAME1 was not live
+	   (Bug#39977).  */
+	error ("No frame to switch to found");
+
       sf = SELECTED_FRAME ();
     }

+  /* At this point, we are committed to deleting the frame.
+     There is no more chance for errors to prevent it.  */
+
   /* Don't allow minibuf_window to remain on a deleted frame.  */
   check_minibuf_window (frame, minibuffer_selected);


  reply	other threads:[~2020-03-15 17:49 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07 17:43 bug#39977: 28.0.50; Unhelpful stack trace Madhu
2020-03-07 18:50 ` Eli Zaretskii
2020-03-13  9:55   ` Eli Zaretskii
2020-03-13 16:28     ` martin rudalics
2020-03-13 19:43       ` Eli Zaretskii
2020-03-14  8:48         ` martin rudalics
2020-03-14 10:10           ` Eli Zaretskii
2020-03-14 10:37             ` martin rudalics
2020-03-14 18:55               ` martin rudalics
2020-03-14 20:09                 ` Eli Zaretskii
2020-03-15 17:49                   ` martin rudalics [this message]
2020-03-15 18:41                     ` Eli Zaretskii
2020-03-16  9:24                       ` martin rudalics
2020-03-16 15:33                         ` Eli Zaretskii
2020-03-17  9:38                           ` martin rudalics
2020-03-17 15:51                             ` Eli Zaretskii
2020-03-17 17:31                               ` martin rudalics
2020-03-17 17:45                                 ` Eli Zaretskii
2020-03-17 18:39                                   ` martin rudalics
2020-03-17 19:41                                     ` Eli Zaretskii
2020-03-18  9:12                                       ` martin rudalics
2020-03-18 14:53                                         ` Eli Zaretskii
2020-03-18 18:48                                           ` martin rudalics
2020-03-18 19:36                                             ` Eli Zaretskii
2020-03-19  8:55                                               ` martin rudalics
2020-03-19 14:33                                                 ` Eli Zaretskii
2020-03-21  9:32                                                   ` martin rudalics
2020-03-21 13:15                                                     ` Eli Zaretskii
2020-03-22 18:20                                                       ` martin rudalics
2020-03-23 14:48                                                         ` Eli Zaretskii
2020-03-24  9:45                                                           ` martin rudalics
2020-03-28  8:23                                                             ` Eli Zaretskii
2020-03-28 18:38                                                               ` martin rudalics
2020-04-03 16:32                                                                 ` martin rudalics
2020-04-10 11:51                                                                   ` Madhu
2020-09-30 15:06                                                                   ` Lars Ingebrigtsen
2020-09-30 15:31                                                                     ` Eli Zaretskii
2020-09-30 17:29                                                                       ` martin rudalics
2020-10-01  0:01                                                                         ` Lars Ingebrigtsen
2020-10-01  4:37                                                                           ` Madhu
2020-03-19  3:48                                             ` Madhu
2020-03-16  2:42                     ` Madhu
2020-03-16  9:25                       ` 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=3ac189d0-5d05-fdf9-0922-0c464b1b17c3@gmx.at \
    --to=rudalics@gmx.at \
    --cc=39977@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=enometh@meer.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).