# HG changeset patch # User Stefan Monnier # Date 1058890365 0 # Node ID 3e9cb0aeebe1dce0923463e6166984930b599ade # Parent 34d5a525041e15b0d5b292c863f2845ac7169977 (get_minibuffer): Be careful when calling `reset_buffer' which assumes the buffer is uninitialized. diff -r 34d5a525041e -r 3e9cb0aeebe1 src/minibuf.c --- a/src/minibuf.c Tue Jul 22 15:26:01 2003 +0000 +++ b/src/minibuf.c Tue Jul 22 16:12:45 2003 +0000 @@ -777,8 +777,27 @@ else { int count = SPECPDL_INDEX (); - - reset_buffer (XBUFFER (buf)); + Lisp_Object overlay; + struct buffer *b = XBUFFER (buf); + + /* `reset_buffer' blindly sets the list of overlays to NULL, so we + have to empty the list, otherwise we end up with overlays that + think they belong to this buffer while the buffer doesn't know about + them any more. */ + while (b->overlays_before) + { + XSETMISC (overlay, b->overlays_before); + Fdelete_overlay (overlay); + } + while (b->overlays_after) + { + XSETMISC (overlay, b->overlays_after); + Fdelete_overlay (overlay); + } + eassert (b->overlays_before == NULL); + eassert (b->overlays_after == NULL); + + reset_buffer (b); record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); Fset_buffer (buf); Fkill_all_local_variables ();