emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109201: Adjust buffer text indirecti


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109201: Adjust buffer text indirection counters at the end of Fkill_buffer.
Date: Wed, 25 Jul 2012 09:09:02 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109201
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-07-25 09:09:02 +0400
message:
  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).
modified:
  src/ChangeLog
  src/buffer.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-24 16:34:15 +0000
+++ b/src/ChangeLog     2012-07-25 05:09:02 +0000
@@ -1,3 +1,12 @@
+2012-07-25  Dmitry Antipov  <address@hidden>
+
+       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  <address@hidden>
 
        * xdisp.c (init_iterator): Don't compute dimensions of truncation
@@ -7,7 +16,7 @@
 2012-07-24  Dmitry Antipov  <address@hidden>
 
        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  <address@hidden>

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-07-24 06:45:44 +0000
+++ b/src/buffer.c      2012-07-25 05:09:02 +0000
@@ -1560,14 +1560,6 @@
   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 @@
   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 @@
   /* 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);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]