summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-09-14 14:43:25 +0200
committerBram Moolenaar <Bram@vim.org>2011-09-14 14:43:25 +0200
commita971b82b160aca28cff7e318d4553df5349b5103 (patch)
tree3fb27e26538bc4ea9cb3671fd763dce2e6183f00 /src/window.c
parent52af96527c914599334e3c2543ebb5ba1e37bbbe (diff)
downloadvim-git-a971b82b160aca28cff7e318d4553df5349b5103.tar.gz
updated for version 7.3.306v7.3.306
Problem: When closing a window there is a chance that deleting a scrollbar triggers a GUI resize, which uses the window while it is not in a valid state. Solution: Set the buffer pointer to NULL to be able to detect the invalid situation. Fix a few places that used the buffer pointer incorrectly.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/window.c b/src/window.c
index b3a7f9e74..6b803f596 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1226,15 +1226,15 @@ win_init(newp, oldp, flags)
}
newp->w_tagstackidx = oldp->w_tagstackidx;
newp->w_tagstacklen = oldp->w_tagstacklen;
-# ifdef FEAT_FOLDING
+#ifdef FEAT_FOLDING
copyFoldingState(oldp, newp);
-# endif
+#endif
win_init_some(newp, oldp);
-# ifdef FEAT_SYN_HL
+#ifdef FEAT_SYN_HL
check_colorcolumn(newp);
-# endif
+#endif
}
/*
@@ -2212,6 +2212,11 @@ win_close(win, free_buf)
out_flush();
#endif
+#ifdef FEAT_SYN_HL
+ /* Free independent synblock before the buffer is freed. */
+ reset_synblock(win);
+#endif
+
/*
* Close the link to the buffer.
*/
@@ -2222,7 +2227,8 @@ win_close(win, free_buf)
if (!win_valid(win) || last_window() || curtab != prev_curtab)
return;
- /* Free the memory used for the window. */
+ /* Free the memory used for the window and get the window that received
+ * the screen space. */
wp = win_free_mem(win, &dir, NULL);
/* Make sure curwin isn't invalid. It can cause severe trouble when
@@ -3247,6 +3253,9 @@ win_init_empty(wp)
else
wp->w_farsi = W_CONV;
#endif
+#ifdef FEAT_SYN_HL
+ wp->w_s = &wp->w_buffer->b_s;
+#endif
}
/*
@@ -4437,7 +4446,6 @@ win_free(wp, tp)
#endif /* FEAT_GUI */
#ifdef FEAT_SYN_HL
- reset_synblock(wp); /* free independent synblock */
vim_free(wp->w_p_cc_cols);
#endif