emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109890: Do not mark objects from del


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109890: Do not mark objects from deleted buffers, windows and frames.
Date: Wed, 05 Sep 2012 19:34:45 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109890
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-09-05 19:34:45 +0400
message:
  Do not mark objects from deleted buffers, windows and frames.
  * alloc.c (mark_buffer): Mark just the buffer if it is dead.
  (mark_object): Likewise for windows and frames.
modified:
  src/ChangeLog
  src/alloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-05 12:55:03 +0000
+++ b/src/ChangeLog     2012-09-05 15:34:45 +0000
@@ -1,5 +1,11 @@
 2012-09-05  Dmitry Antipov  <address@hidden>
 
+       Do not mark objects from deleted buffers, windows and frames.
+       * alloc.c (mark_buffer): Mark just the buffer if it is dead.
+       (mark_object): Likewise for windows and frames.
+
+2012-09-05  Dmitry Antipov  <address@hidden>
+
        * alloc.c (valid_lisp_object_p): Treat killed buffers,
        buffer_defaults and buffer_local_symbols as valid objects.
        Return special value to denote them.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-09-05 12:55:03 +0000
+++ b/src/alloc.c       2012-09-05 15:34:45 +0000
@@ -5838,23 +5838,29 @@
 static void
 mark_buffer (struct buffer *buffer)
 {
-  /* This is handled much like other pseudovectors...  */
-  mark_vectorlike ((struct Lisp_Vector *) buffer);
-
-  /* ...but there are some buffer-specific things.  */
-
-  MARK_INTERVAL_TREE (buffer_intervals (buffer));
-
-  /* For now, we just don't mark the undo_list.  It's done later in
-     a special way just before the sweep phase, and after stripping
-     some of its elements that are not needed any more.  */
-
-  mark_overlay (buffer->overlays_before);
-  mark_overlay (buffer->overlays_after);
-
-  /* If this is an indirect buffer, mark its base buffer.  */
-  if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer))
-    mark_buffer (buffer->base_buffer);
+  if (NILP (BVAR (buffer, name)))
+    /* If the buffer is killed, mark just the buffer itself.  */
+    VECTOR_MARK (buffer);
+  else
+    {
+      /* This is handled much like other pseudovectors...  */
+      mark_vectorlike ((struct Lisp_Vector *) buffer);
+
+      /* ...but there are some buffer-specific things.  */
+
+      MARK_INTERVAL_TREE (buffer_intervals (buffer));
+
+      /* For now, we just don't mark the undo_list.  It's done later in
+        a special way just before the sweep phase, and after stripping
+        some of its elements that are not needed any more.  */
+
+      mark_overlay (buffer->overlays_before);
+      mark_overlay (buffer->overlays_after);
+
+      /* If this is an indirect buffer, mark its base buffer.  */
+      if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer))
+       mark_buffer (buffer->base_buffer);
+    }
 }
 
 /* Determine type of generic Lisp_Object and mark it accordingly.  */
@@ -5997,24 +6003,38 @@
 
          case PVEC_FRAME:
            {
-             mark_vectorlike (ptr);
-             mark_face_cache (((struct frame *) ptr)->face_cache);
+             struct frame *f = (struct frame *) ptr;
+
+             if (FRAME_LIVE_P (f))
+               {
+                 mark_vectorlike (ptr);
+                 mark_face_cache (f->face_cache);
+               }
+             else
+               /* If the frame is deleted, mark just the frame itself.  */
+               VECTOR_MARK (ptr);
            }
            break;
 
          case PVEC_WINDOW:
            {
              struct window *w = (struct window *) ptr;
+             bool leaf = NILP (w->hchild) && NILP (w->vchild);
 
-             mark_vectorlike (ptr);
-             /* Mark glyphs for leaf windows.  Marking window
-                matrices is sufficient because frame matrices
-                use the same glyph memory.  */
-             if (NILP (w->hchild) && NILP (w->vchild)
-                 && w->current_matrix)
+             if (leaf && NILP (w->buffer))
+               /* If the window is deleted, mark just the window itself.  */
+               VECTOR_MARK (ptr);
+             else
                {
-                 mark_glyph_matrix (w->current_matrix);
-                 mark_glyph_matrix (w->desired_matrix);
+                 mark_vectorlike (ptr);
+                 /* Mark glyphs for leaf windows.  Marking window
+                    matrices is sufficient because frame matrices
+                    use the same glyph memory.  */
+                 if (leaf && w->current_matrix)
+                   {
+                     mark_glyph_matrix (w->current_matrix);
+                     mark_glyph_matrix (w->desired_matrix);
+                   }
                }
            }
            break;


reply via email to

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