diff options
author | Bram Moolenaar <Bram@vim.org> | 2011-09-14 14:43:25 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2011-09-14 14:43:25 +0200 |
commit | a971b82b160aca28cff7e318d4553df5349b5103 (patch) | |
tree | 3fb27e26538bc4ea9cb3671fd763dce2e6183f00 /src/buffer.c | |
parent | 52af96527c914599334e3c2543ebb5ba1e37bbbe (diff) | |
download | vim-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/buffer.c')
-rw-r--r-- | src/buffer.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c index 24cbc06eb..81f6fdee8 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -416,6 +416,8 @@ close_buffer(win, buf, action) #endif buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); + if (win_valid(win) && win->w_buffer == buf) + win->w_buffer = NULL; /* make sure we don't use the buffer now */ #ifdef FEAT_AUTOCMD /* Autocommands may have deleted the buffer. */ @@ -560,6 +562,10 @@ buf_freeall(buf, flags) #ifdef FEAT_DIFF diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */ #endif +#ifdef FEAT_SYN_HL + if (curwin->w_buffer == buf) + reset_synblock(curwin); /* remove any ownsyntax */ +#endif #ifdef FEAT_FOLDING /* No folds in an empty buffer. */ @@ -1346,6 +1352,10 @@ set_curbuf(buf, action) # endif #endif { +#ifdef FEAT_SYN_HL + if (prevbuf == curwin->w_buffer) + reset_synblock(curwin); +#endif #ifdef FEAT_WINDOWS if (unload) close_windows(prevbuf, FALSE); @@ -1395,10 +1405,6 @@ enter_buffer(buf) foldUpdateAll(curwin); /* update folds (later). */ #endif -#ifdef FEAT_SYN_HL - reset_synblock(curwin); - curwin->w_s = &(buf->b_s); -#endif /* Get the buffer in the current window. */ curwin->w_buffer = buf; curbuf = buf; @@ -1409,6 +1415,10 @@ enter_buffer(buf) diff_buf_add(curbuf); #endif +#ifdef FEAT_SYN_HL + curwin->w_s = &(buf->b_s); +#endif + /* Cursor on first line by default. */ curwin->w_cursor.lnum = 1; curwin->w_cursor.col = 0; |