Adjust buffer text indirection counters at the end of Fkill_buffer.

* buffer.c (Fkill_buffer): Adjust indirection counters when the
buffer is definitely dead.  This should really fix an issue reported
by Christoph Scholtes again.  (Bug#12007).
(init_buffer_once): Initialize indirection counters of
buffer_defaults and buffer_local_symbols (for sanity and safety).
This commit is contained in:
Dmitry Antipov 2012-07-25 09:09:02 +04:00
parent 9830626b31
commit 04e9897cf7
2 changed files with 22 additions and 10 deletions

View file

@ -1,3 +1,12 @@
2012-07-25 Dmitry Antipov <dmantipov@yandex.ru>
Adjust buffer text indirection counters at the end of Fkill_buffer.
* buffer.c (Fkill_buffer): Adjust indirection counters when the
buffer is definitely dead. This should really fix an issue reported
by Christoph Scholtes again. (Bug#12007).
(init_buffer_once): Initialize indirection counters of
buffer_defaults and buffer_local_symbols (for sanity and safety).
2012-07-24 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (init_iterator): Don't compute dimensions of truncation
@ -7,7 +16,7 @@
2012-07-24 Dmitry Antipov <dmantipov@yandex.ru>
Simplify copy_overlay.
* buffer.c (copy_overlay): Simplify, use build_marker.
* buffer.c (copy_overlay): Simplify. Use build_marker.
* lisp.h (struct Lisp_Overlay): Restore comment with minor tweaks.
2012-07-23 Eli Zaretskii <eliz@gnu.org>

View file

@ -1560,14 +1560,6 @@ cleaning up all windows currently displaying the buffer to be killed. */)
if (EQ (buffer, XWINDOW (minibuf_window)->buffer))
return Qnil;
/* Notify our base buffer that we don't share the text anymore. */
if (b->base_buffer)
{
eassert (b->indirections == -1);
b->base_buffer->indirections--;
eassert (b->base_buffer->indirections >= 0);
}
/* When we kill an ordinary buffer which shares it's buffer text
with indirect buffer(s), we must kill indirect buffer(s) too.
We do it at this stage so nothing terrible happens if they
@ -1708,7 +1700,15 @@ cleaning up all windows currently displaying the buffer to be killed. */)
BVAR (b, name) = Qnil;
BLOCK_INPUT;
if (! b->base_buffer)
if (b->base_buffer)
{
/* Notify our base buffer that we don't share the text anymore. */
eassert (b->indirections == -1);
b->base_buffer->indirections--;
eassert (b->base_buffer->indirections >= 0);
}
else
/* No one shares our buffer text, can free it. */
free_buffer_text (b);
if (b->newline_cache)
@ -4897,6 +4897,9 @@ init_buffer_once (void)
/* Prevent GC from getting confused. */
buffer_defaults.text = &buffer_defaults.own_text;
buffer_local_symbols.text = &buffer_local_symbols.own_text;
/* No one will share the text with these buffers, but let's play it safe. */
buffer_defaults.indirections = 0;
buffer_local_symbols.indirections = 0;
BUF_INTERVALS (&buffer_defaults) = 0;
BUF_INTERVALS (&buffer_local_symbols) = 0;
XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);