>>>> "Y" == Yoshiki Hayashi
<yoshiki(a)xemacs.org> writes:
Y> Yoshiaki Kasahara <kasahara(a)nc.kyushu-u.ac.jp> writes:
> xemacs -vanilla
> M-x make-frame-on-tty
> C-x b test (in the X frame)
> C-x b test (in the tty frame)
> C-x k (in the X frame)
> ** crash **
>
> It is repeatable. It won't crash when doing C-x k in the tty frame.
Y> The problem is that replace-buffer-in-windows doesn't work
Y> correctly when called on X. I can't understand how
Y> window_loop can work under all conditions, so I made a
Y> simpler functions to do it. It does more CONSing, but I
Y> guess it's faster because you don't have to call
Y> Fnext_window every time. Perhaps I should convert some type
Y> of window_loop, too.
I recently rewrote much of this code (to fix some old crashes!) and it
is possible I introduced new ones.
I also had trouble understanding window_loop(). But I think we should
either replace it completely or fix it.
Y> 2000-12-18 Yoshiki Hayashi <yoshiki(a)xemacs.org>
Y> * buffer.c (Fkill_buffer): Map over all devices.
Y> * window.c (window_loop): Remove UNSHOW_BUFFER code.
Y> (list_windows): New function.
Y> (list_all_windows): Ditto.
Y> (Freplace_buffer_in_windows): Use them.
Y> Index: src/buffer.c
Y> ===================================================================
Y> RCS file: /usr/CVSroot/XEmacs/xemacs/src/buffer.c,v
Y> retrieving revision 1.36.2.45
Y> diff -u -r1.36.2.45 buffer.c
Y> --- buffer.c 2000/12/18 11:13:37 1.36.2.45
Y> +++ buffer.c 2000/12/18 11:43:04
Y> @@ -1259,7 +1259,9 @@
Y> /* #### This is a problem if this buffer is in a dedicated window.
Y> Need to undedicate any windows of this buffer first (and delete them?)
Y> */
Y> - Freplace_buffer_in_windows (buf, Qnil, Qnil);
Y> + GCPRO1 (buf);
Y> + Freplace_buffer_in_windows (buf, Qnil, Qall);
Y> + UNGCPRO;
Can you prove GCPROing is necessary here? Perhaps
Freplace_buffer_in_windows() should be called before
delete_from_buffer_alist(), which otherwise GCPROtects buf? The code
has tried to prove that `buf' is a live buffer here.
Y> +static Lisp_Object
Y> +list_windows (struct window *w, Lisp_Object value)
I don't like the idea of consing so much here. Admittedly, it's not
that important here, since buffers don't get killed very often. But
as Yoshiki knows, I would like XEmacs to be efficient when there are
many buffers. I would like lisp programmers to feel free to create
and destroy temporary buffers frequently.
Perhaps you could write a clever WINDOW_LOOP macro? Alternatively,
use a function like map_windows, except extended to handle frame_spec
and device_spec?