From: Stefan Monnier Date: Tue, 22 Jul 2003 16:12:45 +0000 (+0000) Subject: (get_minibuffer): Be careful when calling `reset_buffer' X-Git-Tag: ttn-vms-21-2-B4~9268 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7f856567ea6a2c31034e9266d067522b0d857dc0;p=emacs.git (get_minibuffer): Be careful when calling `reset_buffer' which assumes the buffer is uninitialized. --- diff --git a/src/minibuf.c b/src/minibuf.c index d2331ba5d4e..89830b0391a 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -777,8 +777,27 @@ get_minibuffer (depth) else { int count = SPECPDL_INDEX (); + 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 (XBUFFER (buf)); + reset_buffer (b); record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); Fset_buffer (buf); Fkill_all_local_variables ();