unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: monnier@iro.umontreal.ca, cyd@stupidchicken.com
Cc: 7728@debbugs.gnu.org
Subject: bug#7728: 24.0.50; GDB backtrace from abort
Date: Sun, 09 Jan 2011 23:18:14 +0200	[thread overview]
Message-ID: <83ei8lkc89.fsf@gnu.org> (raw)
In-Reply-To: <837heopknq.fsf@gnu.org>

Ping!

This is a bug that I think we should fix for Emacs 23.3.

> Date: Sat, 01 Jan 2011 20:02:17 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 7728@debbugs.gnu.org
> 
> > From: Stefan Monnier <monnier@iro.umontreal.ca>
> > Cc: Drew Adams <drew.adams@oracle.com>,  7728@debbugs.gnu.org
> > Date: Sat, 25 Dec 2010 15:35:31 -0500
> > 
> > If selected_window is nil because of Fset_window_configuration, then it
> > is presumably nil for all the intervening and some of the subsequent
> > code, and I suspect fixing it earlier in the call chain will be
> > preferable: e.g., it doesn't make sense to "display_and_set_cursor" in
> > the "selected_window = nil" case.
> 
> After some looking around, I'm sorry to report that I don't see how to
> do that.  Here are the details:
> 
> We set selected_window to nil as a semi-kludgey way of preventing
> select-window from storing in the old selected window the value of
> point of the buffer that has been restored into that window.
> select-window has this code:
> 
>   sf = SELECTED_FRAME ();
>   if (XFRAME (WINDOW_FRAME (w)) != sf)
>     {
>       XFRAME (WINDOW_FRAME (w))->selected_window = window;
>       /* Use this rather than Fhandle_switch_frame
> 	 so that FRAME_FOCUS_FRAME is moved appropriately as we
> 	 move around in the state where a minibuffer in a separate
> 	 frame is active.  */
>       Fselect_frame (WINDOW_FRAME (w), norecord);
>       /* Fselect_frame called us back so we've done all the work already.  */
>       eassert (EQ (window, selected_window));
>       return window;
>     }
>   else
>     sf->selected_window = window;
> 
>   /* Store the current buffer's actual point into the
>      old selected window.  It belongs to that window,
>      and when the window is not selected, must be in the window.  */
>   if (!NILP (selected_window))
>     {
>       ow = XWINDOW (selected_window);
>       if (! NILP (ow->buffer))
> 	set_marker_both (ow->pointm, ow->buffer,
> 			 BUF_PT (XBUFFER (ow->buffer)),
> 			 BUF_PT_BYTE (XBUFFER (ow->buffer)));
>     }
> 
>   selected_window = window;
> 
> The last `if' clause is what we want to bypass, when we restore window
> configuration as the last part of save-window-excursion.  Note that
> select-window stores the right value into selected_window right after
> that, but the call to Fselect_frame that crashes happens before that,
> so selected_window is still nil.
> 
> Now, the sequence of calls leading to the crash inside Fselect_frame
> is as follows:
> 
>   Fselect_frame
>   -> do_switch_frame
>      -> Fredirect_frame_focus
>         -> w32_frame_rehighlight / XTframe_rehighlight
>            -> x_frame_rehighlight
>               -> frame_highlight
>                  -> x_update_cursor
>                     -> update_cursor_in_window_tree
>                        -> update_window_cursor
>                           -> display_and_set_cursor
>                              -> erase_phys_cursor
>                                 -> window_text_bottom_y
>                                    -> die
> 
> My conclusion after studying this is that everything that happens
> below Fselect_frame is reasonable: we switch to the frame and redraw
> the cursor in all of its windows.  In particular,
> update_cursor_in_window_tree simply walks the entire window tree of
> the newly selected frame.  I don't see how we can avoid any of this
> when selected_window is nil, because selected_window has nothing to do
> with the windows that are being processed.  None of these functions
> even references selected_window, which is TRT.  The first place that
> does reference selected_window is the CURRENT_MODE_LINE_HEIGHT macro
> used in window_text_bottom_y, and that leads to the abort.
> 
> So I see 2 ways to prevent this particular problem:
> 
>  1) Handle the case of selected_window == Qnil in
>     CURRENT_MODE_LINE_FACE_ID.
> 
>  2) Change the code of Fset_window_configuration and Fselect_window,
>     to have some other way of preventing the latter from storing point
>     in the old selected window, without setting selected_window to
>     nil.
> 
> Any other ideas are welcome.
> 





  reply	other threads:[~2011-01-09 21:18 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-24 16:55 bug#7728: 24.0.50; GDB backtrace from abort Drew Adams
2010-12-25  9:38 ` Eli Zaretskii
2010-12-25 10:44   ` Andreas Schwab
2010-12-25 11:12     ` Eli Zaretskii
2010-12-25 20:35   ` Stefan Monnier
2011-01-01 18:02     ` Eli Zaretskii
2011-01-09 21:18       ` Eli Zaretskii [this message]
2011-01-10 23:32         ` Drew Adams
2011-01-11 20:55       ` Stefan Monnier
2011-01-11 21:14         ` Eli Zaretskii
2011-01-11 21:44           ` Drew Adams
2011-01-12  4:11             ` Eli Zaretskii
2011-01-12  4:59               ` Drew Adams
2011-01-12 11:03                 ` Eli Zaretskii
2011-01-12 18:36                   ` Drew Adams
2011-01-12 19:52                   ` Drew Adams
2011-01-12 21:30                     ` Drew Adams
2011-01-12  7:54         ` martin rudalics
2011-01-12 15:05           ` Drew Adams
2011-01-12 15:14           ` Stefan Monnier
2011-01-12 15:59             ` martin rudalics
2011-01-12 16:22             ` Eli Zaretskii
2011-01-12 17:42               ` martin rudalics
2011-01-12 17:48                 ` Eli Zaretskii
2011-01-12 18:35                   ` martin rudalics
2011-01-12 18:36                   ` Drew Adams
2011-01-15  2:59                 ` Chong Yidong
2011-01-15 20:05                   ` martin rudalics
2011-01-13  2:53               ` Stefan Monnier
2011-01-13  7:07                 ` Drew Adams
2011-01-13 17:02                   ` Stefan Monnier
2011-01-13 17:57                     ` Drew Adams
2011-01-13 21:24                       ` Stefan Monnier
2011-01-13 22:06                         ` Drew Adams
2011-01-14  0:26                       ` Eli Zaretskii
2011-01-14  1:19                         ` Drew Adams
2011-01-14  2:40                           ` Eli Zaretskii
2011-01-14  6:46                             ` Drew Adams
2011-01-14  7:09                               ` Drew Adams
2011-01-14 20:01                         ` Sean Sieger
2011-01-14 21:06                           ` Drew Adams
2011-01-14 21:46                             ` Sean Sieger
2011-01-14 22:51                               ` Eli Zaretskii
2011-01-14 23:56                                 ` Sean Sieger
2011-01-14  2:25                       ` Stefan Monnier
2011-01-14  4:25                         ` Drew Adams
2011-01-14  8:26                     ` martin rudalics
2011-01-14  8:58                       ` Drew Adams
2011-01-14 15:30                         ` Stefan Monnier
2011-01-16 20:44                           ` Drew Adams

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=83ei8lkc89.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=7728@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=monnier@iro.umontreal.ca \
    /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).