emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110512: * src/buffer.c (Fkill_buffer


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110512: * src/buffer.c (Fkill_buffer): Null out the overlay list(s) as well.
Date: Thu, 11 Oct 2012 16:32:11 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110512
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2012-10-11 16:32:11 -0400
message:
  * src/buffer.c (Fkill_buffer): Null out the overlay list(s) as well.
modified:
  src/ChangeLog
  src/buffer.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-10-11 20:08:38 +0000
+++ b/src/ChangeLog     2012-10-11 20:32:11 +0000
@@ -1,5 +1,7 @@
 2012-10-11  Stefan Monnier  <address@hidden>
 
+       * buffer.c (Fkill_buffer): Null out the overlay list(s) as well.
+
        * eval.c (Fautoload): Remember previous autoload status in load-history.
 
 2012-10-11  Paul Eggert  <address@hidden>

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-10-02 02:43:53 +0000
+++ b/src/buffer.c      2012-10-11 20:32:11 +0000
@@ -897,6 +897,8 @@
 {
   struct Lisp_Overlay *ov, *next;
 
+  /* FIXME: Since each drop_overlay will scan BUF_MARKERS to unlink its
+     markers, we have an unneeded O(N^2) behavior here.  */
   for (ov = b->overlays_before; ov; ov = next)
     {
       drop_overlay (b, ov);
@@ -1886,16 +1888,19 @@
 
   if (b->base_buffer)
     {
-      /* Unchain all markers that belong to this indirect buffer.
-        Don't unchain the markers that belong to the base buffer
-        or its other indirect buffers.  */
-      for (m = BUF_MARKERS (b); m; )
-       {
-         struct Lisp_Marker *next = m->next;
-         if (m->buffer == b)
-           unchain_marker (m);
-         m = next;
-       }
+      { /* Unchain all markers that belong to this indirect buffer.
+          Don't unchain the markers that belong to the base buffer
+          or its other indirect buffers.  */
+       struct Lisp_Marker **mp;
+       for (mp = &BUF_MARKERS (b); *mp; )
+         {
+           struct Lisp_Marker *m = *mp;
+           if (m->buffer == b)
+             *mp = m->next;
+           else
+             mp = &m->next;
+         }
+      }
     }
   else
     {
@@ -1911,8 +1916,12 @@
       BUF_MARKERS (b) = NULL;
       set_buffer_intervals (b, NULL);
 
-      /* Perhaps we should explicitly free the interval tree here... */
+      /* Perhaps we should explicitly free the interval tree here...  */
     }
+  /* Since we've unlinked the markers, the overlays can't be here any more
+     either.  */
+  b->overlays_before = NULL;
+  b->overlays_after = NULL;
 
   /* Reset the local variables, so that this buffer's local values
      won't be protected from GC.  They would be protected


reply via email to

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