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: Tue, 17 Mar 2020 18:31:18 +0100 [thread overview]
Message-ID: <7a0b9999-6778-6235-fbc9-2a24b4e3bc53@gmx.at> (raw)
In-Reply-To: <83y2rzf08m.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 383 bytes --]
> You are proposing that we find all the places where SELECTED_FRAME is
> used and fix them one by one? I thought it could be better to fix
> them all at once as part of SELECTED_FRAME.
We are still miscommunicating. I only want to fix the parts that
restore selected_frame so to make sure that they never set it to a dead
frame. See the attached selected_frame.diff.
martin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: selected_frame.diff --]
[-- Type: text/x-patch; name="selected_frame.diff", Size: 3608 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);
diff --git a/src/xdisp.c b/src/xdisp.c
index 3a8b5e3f1d..e573c7cf88 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12608,6 +12608,16 @@ fast_set_selected_frame (Lisp_Object frame)
}
}
+static void
+fast_set_selected_frame_if_live (Lisp_Object frame)
+{
+ if (!EQ (selected_frame, frame) && FRAME_LIVE_P (XFRAME (frame)))
+ {
+ selected_frame = frame;
+ selected_window = XFRAME (frame)->selected_window;
+ }
+}
+
#endif /* HAVE_WINDOW_SYSTEM */
/* Update the tab-bar item list for frame F. This has to be done
@@ -12681,7 +12691,7 @@ update_tab_bar (struct frame *f, bool save_match_data)
XFRAME (selected_frame)->selected_window));
#ifdef HAVE_WINDOW_SYSTEM
Lisp_Object frame;
- record_unwind_protect (fast_set_selected_frame, selected_frame);
+ record_unwind_protect (fast_set_selected_frame_if_live, selected_frame);
XSETFRAME (frame, f);
fast_set_selected_frame (frame);
#endif
@@ -13625,7 +13635,7 @@ update_tool_bar (struct frame *f, bool save_match_data)
/* Since we only explicitly preserve selected_frame,
check that selected_window would be redundant. */
XFRAME (selected_frame)->selected_window));
- record_unwind_protect (fast_set_selected_frame, selected_frame);
+ record_unwind_protect (fast_set_selected_frame_if_live, selected_frame);
XSETFRAME (frame, f);
fast_set_selected_frame (frame);
@@ -25009,9 +25019,14 @@ display_mode_lines (struct window *w)
++n;
}
- XFRAME (new_frame)->selected_window = old_frame_selected_window;
- selected_frame = old_selected_frame;
- selected_window = old_selected_window;
+ if (WINDOW_LIVE_P (old_frame_selected_window))
+ XFRAME (new_frame)->selected_window = old_frame_selected_window;
+ if (FRAME_LIVE_P (XFRAME (old_selected_frame)))
+ {
+ selected_frame = old_selected_frame;
+ selected_window = old_selected_window;
+ }
+
if (n > 0)
w->must_be_updated_p = true;
return n;
next prev parent reply other threads:[~2020-03-17 17:31 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
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 [this message]
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=7a0b9999-6778-6235-fbc9-2a24b4e3bc53@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).