Subject: bug#11984: 24.1; segfault while deleting a window

From: Eli Zaretskii <[email-masked]>
Date: Wed, 25 Jul 2012 18:27:27 +0300

> Date: Wed, 25 Jul 2012 09:15:03 +0200
> From: martin rudalics <[email-masked]>
> CC: [email-masked], [email-masked], [email-masked]
> 
>  > If you built Emacs with the change, and tooltips work for you,
> 
> How do I test it?  Is evaluating
> 
> (x-show-tip "???")
> 
> enough?

Probably, but I find it easier to move the mouse pointer over some of
the mouse-sensitive areas of the display (tool bar, menu items, mode
line), each time waiting for the tooltip to pop up and then pop down
after a few seconds.

> Because tooltip frames appear fragile.  x_create_tip_frame uses
> 
>    Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
> 
> while make_frame has
> 
>      /* Use set_window_buffer, not Fset_window_buffer, and don't let
>         hooks be run by it.  The reason is that the whole frame/window
>         arrangement is not yet fully initialized at this point.  Windows
>         don't have the right size, glyph matrices aren't initialized
>         etc.  Running Lisp functions at this point surely ends in a
>         SEGV.  */
>      set_window_buffer (root_window, buf, 0, 0);
> 
> Wouldn't the fact that the frame has not been set up completely when
> assigning a buffer to its root window suggest that Fset_window_buffer
> should not be used here either?

I know almost nothing about these intimate details.  Exactly what is
it that makes running the hooks safe, and when does it happen during
frame creation, is not documented anywhere, AFAICS.

So feel free to replace the call to Fset_window_buffer with
set_window_buffer, if you think that's more appropriate.