diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/alloc.c | 64 |
2 files changed, 48 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3d2e25f7828..a0c3f3537bb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2012-09-05 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2012-09-05 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | Do not mark objects from deleted buffers, windows and frames. | ||
| 4 | * alloc.c (mark_buffer): Mark just the buffer if it is dead. | ||
| 5 | (mark_object): Likewise for windows and frames. | ||
| 6 | |||
| 7 | 2012-09-05 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 8 | |||
| 3 | * alloc.c (valid_lisp_object_p): Treat killed buffers, | 9 | * alloc.c (valid_lisp_object_p): Treat killed buffers, |
| 4 | buffer_defaults and buffer_local_symbols as valid objects. | 10 | buffer_defaults and buffer_local_symbols as valid objects. |
| 5 | Return special value to denote them. | 11 | Return special value to denote them. |
diff --git a/src/alloc.c b/src/alloc.c index 80ab2d2cb97..e90cca637df 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5838,23 +5838,29 @@ mark_overlay (struct Lisp_Overlay *ptr) | |||
| 5838 | static void | 5838 | static void |
| 5839 | mark_buffer (struct buffer *buffer) | 5839 | mark_buffer (struct buffer *buffer) |
| 5840 | { | 5840 | { |
| 5841 | /* This is handled much like other pseudovectors... */ | 5841 | if (NILP (BVAR (buffer, name))) |
| 5842 | mark_vectorlike ((struct Lisp_Vector *) buffer); | 5842 | /* If the buffer is killed, mark just the buffer itself. */ |
| 5843 | VECTOR_MARK (buffer); | ||
| 5844 | else | ||
| 5845 | { | ||
| 5846 | /* This is handled much like other pseudovectors... */ | ||
| 5847 | mark_vectorlike ((struct Lisp_Vector *) buffer); | ||
| 5843 | 5848 | ||
| 5844 | /* ...but there are some buffer-specific things. */ | 5849 | /* ...but there are some buffer-specific things. */ |
| 5845 | 5850 | ||
| 5846 | MARK_INTERVAL_TREE (buffer_intervals (buffer)); | 5851 | MARK_INTERVAL_TREE (buffer_intervals (buffer)); |
| 5847 | 5852 | ||
| 5848 | /* For now, we just don't mark the undo_list. It's done later in | 5853 | /* For now, we just don't mark the undo_list. It's done later in |
| 5849 | a special way just before the sweep phase, and after stripping | 5854 | a special way just before the sweep phase, and after stripping |
| 5850 | some of its elements that are not needed any more. */ | 5855 | some of its elements that are not needed any more. */ |
| 5851 | 5856 | ||
| 5852 | mark_overlay (buffer->overlays_before); | 5857 | mark_overlay (buffer->overlays_before); |
| 5853 | mark_overlay (buffer->overlays_after); | 5858 | mark_overlay (buffer->overlays_after); |
| 5854 | 5859 | ||
| 5855 | /* If this is an indirect buffer, mark its base buffer. */ | 5860 | /* If this is an indirect buffer, mark its base buffer. */ |
| 5856 | if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer)) | 5861 | if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer)) |
| 5857 | mark_buffer (buffer->base_buffer); | 5862 | mark_buffer (buffer->base_buffer); |
| 5863 | } | ||
| 5858 | } | 5864 | } |
| 5859 | 5865 | ||
| 5860 | /* Determine type of generic Lisp_Object and mark it accordingly. */ | 5866 | /* Determine type of generic Lisp_Object and mark it accordingly. */ |
| @@ -5997,24 +6003,38 @@ mark_object (Lisp_Object arg) | |||
| 5997 | 6003 | ||
| 5998 | case PVEC_FRAME: | 6004 | case PVEC_FRAME: |
| 5999 | { | 6005 | { |
| 6000 | mark_vectorlike (ptr); | 6006 | struct frame *f = (struct frame *) ptr; |
| 6001 | mark_face_cache (((struct frame *) ptr)->face_cache); | 6007 | |
| 6008 | if (FRAME_LIVE_P (f)) | ||
| 6009 | { | ||
| 6010 | mark_vectorlike (ptr); | ||
| 6011 | mark_face_cache (f->face_cache); | ||
| 6012 | } | ||
| 6013 | else | ||
| 6014 | /* If the frame is deleted, mark just the frame itself. */ | ||
| 6015 | VECTOR_MARK (ptr); | ||
| 6002 | } | 6016 | } |
| 6003 | break; | 6017 | break; |
| 6004 | 6018 | ||
| 6005 | case PVEC_WINDOW: | 6019 | case PVEC_WINDOW: |
| 6006 | { | 6020 | { |
| 6007 | struct window *w = (struct window *) ptr; | 6021 | struct window *w = (struct window *) ptr; |
| 6022 | bool leaf = NILP (w->hchild) && NILP (w->vchild); | ||
| 6008 | 6023 | ||
| 6009 | mark_vectorlike (ptr); | 6024 | if (leaf && NILP (w->buffer)) |
| 6010 | /* Mark glyphs for leaf windows. Marking window | 6025 | /* If the window is deleted, mark just the window itself. */ |
| 6011 | matrices is sufficient because frame matrices | 6026 | VECTOR_MARK (ptr); |
| 6012 | use the same glyph memory. */ | 6027 | else |
| 6013 | if (NILP (w->hchild) && NILP (w->vchild) | ||
| 6014 | && w->current_matrix) | ||
| 6015 | { | 6028 | { |
| 6016 | mark_glyph_matrix (w->current_matrix); | 6029 | mark_vectorlike (ptr); |
| 6017 | mark_glyph_matrix (w->desired_matrix); | 6030 | /* Mark glyphs for leaf windows. Marking window |
| 6031 | matrices is sufficient because frame matrices | ||
| 6032 | use the same glyph memory. */ | ||
| 6033 | if (leaf && w->current_matrix) | ||
| 6034 | { | ||
| 6035 | mark_glyph_matrix (w->current_matrix); | ||
| 6036 | mark_glyph_matrix (w->desired_matrix); | ||
| 6037 | } | ||
| 6018 | } | 6038 | } |
| 6019 | } | 6039 | } |
| 6020 | break; | 6040 | break; |