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

From: martin rudalics <[email-masked]>
Date: Sun, 10 Jul 2011 10:59:53 +0200

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

I suppose because `vertical-motion' can do all sorts of nasty things,
probably during fontification or scanning pbm images ...

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

Which code?  The tabbar code "normally works" because it's not
interrupted by C-g.  `vertical-motion' "normally works" because it works
on the buffer shown in the selected window.  In the present case we (1)
temporarily show another buffer in the selected window and (2) interrupt
its execution in a state where that other buffer is still shown in that
window.

 >> 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?

I suppose it's, as Stephen pointed out, that after `vertical-motion'
exited forcefully, exiting `with-temp-buffer' tries to find another
buffer to show in that window.  Obviously, this should not happen
because `vertical-motion' should have cleaned up its state before ...

martin