Subject: bug#9006: 24.0.50; Abort in unshow_buffer/kill-buffer

From: Eli Zaretskii <[email-masked]>
Date: Sat, 09 Jul 2011 20:31:42 +0300

> Date: Sat, 09 Jul 2011 10:44:39 +0200
> From: martin rudalics <[email-masked]>
> Cc: [email-masked]
> 
> I think there are three problems with this.
> 
>  > #1  0x080a71a7 in unshow_buffer (w=0x9a8e828)
>  >     at /data/steve/bzr/emacs/quickfixes/src/window.c:1801
>  >         buf = 218835381
>  >         b = 0xd0b29b0
> 
> This problem is certainly due to the fact that vertical_motion blindly
> does
> 
>    if (XBUFFER (w->buffer) != current_buffer)
>      {
>        /* Set the window's buffer temporarily to the current buffer.  */
>        old_buffer = w->buffer;
>        XSETBUFFER (w->buffer, current_buffer);
>      }
> 
> and probably should do at least something like
> 
>    if (XBUFFER (w->buffer) != current_buffer)
>      {
>        /* Set the window's buffer temporarily to the current buffer.  */
>        old_buffer = w->buffer;
>        XSETBUFFER (w->buffer, current_buffer);
>        set_marker_both (w->pointm, buffer, BEG, BEG_BYTE);
>      }
> 
> instead.

How is vertical-motion relevant to the user typing C-g?

And why does this code normally works, if it is wrong?  What am I
missing?

> Allowing to kill a temporary buffer while it's shown in a window just to
> calculate how far `vertical-motion' would go if the buffer were shown in
> a window is asking for trouble.

I don't understand how come vertical-motion ended up calling Lisp, as
this Lisp backtrace shows:

> Lisp Backtrace:
> "set-window-buffer" (0xbfff66d4)
> "set-window-buffer-start-and-point" (0xbfff6854)
> "byte-code" (0xbfff6964)
> "switch-to-prev-buffer" (0xbfff6c54)
> "replace-buffer-in-windows" (0xbfff6dec)
> "kill-buffer" (0xbfff6eb4)
> "and" (0xbfff6fa8)
> "vertical-motion" (0xbfff7d24)

And why does that Lisp code call kill-buffer?