Subject: bug#31312: Segmentation fault with doom-emacs, NeoTree and Zoom

From: Eli Zaretskii <[email-masked]>
Date: Wed, 02 May 2018 18:03:45 +0300

> Date: Wed, 02 May 2018 15:42:58 +0200
> From: martin rudalics <[email-masked]>
> CC: [email-masked], Andrea Cardaci <[email-masked]>
> 
>  > So we need the same defense after prepare_menu_bars as we
>  > have after do_pending_changes, I think.
> 
> If you mean something like
> 
>    if (WINDOWP (selected_window) && (w = XWINDOW (selected_window)) != sw)
>      sw = w;
> 
> I'm afraid that this would fail since selected_window has no buffer
> any more (or may have even been recycled already).

Is that a fact?  I might be mistaken, but my take on what Noam found
was that the selected window is OK, it's just that the window held in
W is dead (i.e. it was deleted inside the tempest that happened in
run_window_size_change_functions called by prepare_menu_bars).  So my
suggestion is to update W with the new selected window.

In general, if the selected window has no buffer, we are in deep
trouble, and not just in redisplay.  So I very much hope this is not
what happens here.