]> git.eshelyaron.com Git - emacs.git/commitdiff
Do not verify indirection counters of killed buffers (Bug#12579).
authorDmitry Antipov <dmantipov@yandex.ru>
Wed, 17 Oct 2012 04:58:15 +0000 (08:58 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Wed, 17 Oct 2012 04:58:15 +0000 (08:58 +0400)
* buffer.h (BUFFER_CHECK_INDIRECTION): New macro.
* buffer.c (compact_buffer, set_buffer_internal_1): Use it.

src/ChangeLog
src/buffer.c
src/buffer.h

index 3c62dffc3e03343c95056d810cd8a59f87f3bc82..bea7c9331db5a90b4648792f59c95dab4902e9f9 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-17  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Do not verify indirection counters of killed buffers (Bug#12579).
+       * buffer.h (BUFFER_CHECK_INDIRECTION): New macro.
+       * buffer.c (compact_buffer, set_buffer_internal_1): Use it.
+
 2012-10-16  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * alloc.c (Fmake_byte_code): Fix typo in comment.
index 861a89b5a0fabeed102199999d415a557fc04028..8e77db66d4386e83ec4d168d5c3e745be6142761 100644 (file)
@@ -1663,18 +1663,11 @@ No argument or nil as argument means do this for the current buffer.  */)
 void
 compact_buffer (struct buffer *buffer)
 {
-  /* Verify indirection counters.  */
-  if (buffer->base_buffer)
-    {
-      eassert (buffer->indirections == -1);
-      eassert (buffer->base_buffer->indirections > 0);
-    }
-  else
-    eassert (buffer->indirections >= 0);
+  BUFFER_CHECK_INDIRECTION (buffer);
 
   /* Skip dead buffers, indirect buffers and buffers
      which aren't changed since last compaction.  */
-  if (!NILP (buffer->INTERNAL_FIELD (name))
+  if (BUFFER_LIVE_P (buffer)
       && (buffer->base_buffer == NULL)
       && (buffer->text->compact != buffer->text->modiff))
     {
@@ -2114,6 +2107,8 @@ set_buffer_internal_1 (register struct buffer *b)
   if (current_buffer == b)
     return;
 
+  BUFFER_CHECK_INDIRECTION (b);
+  
   old_buf = current_buffer;
   current_buffer = b;
   last_known_column_point = -1;   /* invalidate indentation cache */
index d18ef30ea385fa179da58d75e7a9f3d3003a9655..9e0e9eef0b17cef7df8f591975fb836fbcf3f763 100644 (file)
@@ -963,6 +963,22 @@ bset_width_table (struct buffer *b, Lisp_Object val)
 
 #define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name)))
 
+/* Verify indirection counters.  */
+
+#define BUFFER_CHECK_INDIRECTION(b)                    \
+  do {                                                 \
+    if (BUFFER_LIVE_P (b))                             \
+    {                                                  \
+      if (b->base_buffer)                              \
+       {                                               \
+         eassert (b->indirections == -1);              \
+         eassert (b->base_buffer->indirections > 0);   \
+       }                                               \
+      else                                             \
+       eassert (b->indirections >= 0);                 \
+    }                                                  \
+  } while (0)
+
 /* Chain of all buffers, including killed ones.  */
 
 extern struct buffer *all_buffers;