=== modified file 'src/alloc.c' --- src/alloc.c 2012-09-13 05:18:26 +0000 +++ src/alloc.c 2012-09-14 11:11:54 +0000 @@ -5865,32 +5865,6 @@ mark_buffer (buffer->base_buffer); } -/* Remove killed buffers or items whose car is a killed buffer from - LIST, and mark other items. Return changed LIST, which is marked. */ - -static Lisp_Object -mark_discard_killed_buffers (Lisp_Object list) -{ - Lisp_Object tail, *prev = &list; - - for (tail = list; CONSP (tail) && !CONS_MARKED_P (XCONS (tail)); - tail = XCDR (tail)) - { - Lisp_Object tem = XCAR (tail); - if (CONSP (tem)) - tem = XCAR (tem); - if (BUFFERP (tem) && !BUFFER_LIVE_P (XBUFFER (tem))) - *prev = XCDR (tail); - else - { - CONS_MARK (XCONS (tail)); - mark_object (XCAR (tail)); - prev = &XCDR_AS_LVALUE (tail); - } - } - return list; -} - /* Determine type of generic Lisp_Object and mark it accordingly. */ void @@ -6034,24 +6008,12 @@ case PVEC_WINDOW: { struct window *w = (struct window *) ptr; - bool leaf = NILP (w->hchild) && NILP (w->vchild); - - /* For live windows, Lisp code filters out killed buffers - from both buffer lists. For dead windows, we do it here - in attempt to help GC to reclaim killed buffers faster. */ - if (leaf && NILP (w->buffer)) - { - wset_prev_buffers - (w, mark_discard_killed_buffers (w->prev_buffers)); - wset_next_buffers - (w, mark_discard_killed_buffers (w->next_buffers)); - } 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) + if (NILP (w->hchild) && NILP (w->vchild) && w->current_matrix) { mark_glyph_matrix (w->current_matrix); mark_glyph_matrix (w->desired_matrix); === modified file 'src/window.c' --- src/window.c 2012-09-11 15:42:50 +0000 +++ src/window.c 2012-09-14 12:09:06 +0000 @@ -3988,6 +3988,31 @@ return new; } +/* Reset W's fields so WINDOW_VALID_P is non-zero for W. */ + +static void +kill_window (struct window *w) +{ + if (!NILP (w->vchild)) + { + delete_all_child_windows (w->vchild); + wset_vchild (w, Qnil); + } + else if (!NILP (w->hchild)) + { + delete_all_child_windows (w->hchild); + wset_hchild (w, Qnil); + } + else if (!NILP (w->buffer)) + { + unshow_buffer (w); + unchain_marker (XMARKER (w->pointm)); + unchain_marker (XMARKER (w->start)); + wset_buffer (w, Qnil); + } + wset_prev_buffers (w, Qnil); + wset_next_buffers (w, Qnil); +} DEFUN ("delete-window-internal", Fdelete_window_internal, Sdelete_window_internal, 1, 1, 0, doc: /* Remove WINDOW from its frame. @@ -4078,23 +4103,8 @@ wset_next (w, Qnil); /* Don't delete w->next too. */ free_window_matrices (w); - if (!NILP (w->vchild)) - { - delete_all_child_windows (w->vchild); - wset_vchild (w, Qnil); - } - else if (!NILP (w->hchild)) - { - delete_all_child_windows (w->hchild); - wset_hchild (w, Qnil); - } - else if (!NILP (w->buffer)) - { - unshow_buffer (w); - unchain_marker (XMARKER (w->pointm)); - unchain_marker (XMARKER (w->start)); - wset_buffer (w, Qnil); - } + /* W is really dead after this. */ + kill_window (w); if (NILP (s->prev) && NILP (s->next)) /* A matrjoshka where SIBLING has become the only child of @@ -5486,6 +5496,7 @@ Lisp_Object parent, prev; Lisp_Object start_at_line_beg; Lisp_Object display_table; + Lisp_Object prev_buffers, next_buffers; Lisp_Object left_margin_cols, right_margin_cols; Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins; Lisp_Object scroll_bar_width, vertical_scroll_bar_type, dedicated; @@ -5726,6 +5737,8 @@ w->hscroll = XFASTINT (p->hscroll); w->min_hscroll = XFASTINT (p->min_hscroll); wset_display_table (w, p->display_table); + wset_prev_buffers (w, p->prev_buffers); + wset_next_buffers (w, p->next_buffers); wset_left_margin_cols (w, p->left_margin_cols); wset_right_margin_cols (w, p->right_margin_cols); wset_left_fringe_width (w, p->left_fringe_width); @@ -5926,23 +5939,8 @@ /* See Fset_window_configuration for excuse. */ wset_total_lines (w, w->buffer); - if (!NILP (w->vchild)) - { - delete_all_child_windows (w->vchild); - wset_vchild (w, Qnil); - } - else if (!NILP (w->hchild)) - { - delete_all_child_windows (w->hchild); - wset_hchild (w, Qnil); - } - else if (!NILP (w->buffer)) - { - unshow_buffer (w); - unchain_marker (XMARKER (w->pointm)); - unchain_marker (XMARKER (w->start)); - wset_buffer (w, Qnil); - } + /* W is really dead after this. */ + kill_window (w); Vwindow_list = Qnil; } @@ -6045,6 +6043,8 @@ XSETFASTINT (p->hscroll, w->hscroll); XSETFASTINT (p->min_hscroll, w->min_hscroll); p->display_table = w->display_table; + p->prev_buffers = w->prev_buffers; + p->next_buffers = w->next_buffers; p->left_margin_cols = w->left_margin_cols; p->right_margin_cols = w->right_margin_cols; p->left_fringe_width = w->left_fringe_width;