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

From: Stephen Berman <[email-masked]>
Date: Mon, 11 Jul 2011 22:04:35 +0200

On Mon, 11 Jul 2011 21:14:07 +0200 martin rudalics <[email-masked]> wrote:

>> I applied the patch and rebuilt Emacs, then started with my
>> initializations under gdb.  Emacs came up fine, then I type C-h C-a and
>> it aborted in unshow_buffer; the backtrace is almost identical to the
>> one I posted previously.
>
> Why am I not surprised?  Though, it doesn't abort here.

Puzzling; I discovered today that I also get the abort with that patch
just by starting emacs -Q, evalling (with-temp-buffer (vertical-motion
1)), then typing C-h C-a.

>> Then I started Emacs again, started Gnus, as
>> with your first suggested patch with set_marker_both (w->buffer, BEG,
>> BEGV)
>
> I suppose you mean set_marker_both (w->pointm, w->buffer, BEG, BEGV)
> here.

Yes, sorry for the typo.

>> the display was unstable (unselected window at first blank, then
>> blank fringe), then tried `h' and it worked a few times but the response
>> was slow, and then (after `h' not C-g) Emacs aborted in unshow_buffer;
>> backtrace below.  Just out of curiosity (since I don't understand the
>> code), I rebuilt again with the following call (old_buffer instead of
>> w->buffer):
>>
>>        set_marker_both
>>  	(w->pointm, old_buffer, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
>>
>> This did not cause an abort with C-h C-a nor with h in Gnus, but it
>> showed the same problem of point in the non-selected window jumping to
>> point-min, despite not passing BEG and BEGV.
>
> The strange thing about this is that when old_buffer is not the current
> buffer, this will set the marker in the wrong buffer which should cause
> an abort.  But as I stated earlier I'm still completely lost here :-(
>
> Anyway, I attached another patch.  Things are getting more and more
> complicated because I have zero experience working with markers in C.

I applied it and rebuilt, and so far things look good: display is
normal, C-h C-a works fine, and in Gnus both h and and C-x o don't move
point in the non-selected buffer.  In short, this looks like a good
fix -- thanks!  I'll keep running under gdb and let you know if anything
surprising happens.  Bar that, I think you should install this, unless
someone has a good reason to object.

Steve Berman