+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
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>
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
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)
/* 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);