mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
updated for version 7.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.
This commit is contained in:
parent
52af96527c
commit
a971b82b16
18
src/buffer.c
18
src/buffer.c
@ -416,6 +416,8 @@ close_buffer(win, buf, action)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
|
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
|
#ifdef FEAT_AUTOCMD
|
||||||
/* Autocommands may have deleted the buffer. */
|
/* Autocommands may have deleted the buffer. */
|
||||||
@ -560,6 +562,10 @@ buf_freeall(buf, flags)
|
|||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */
|
diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_SYN_HL
|
||||||
|
if (curwin->w_buffer == buf)
|
||||||
|
reset_synblock(curwin); /* remove any ownsyntax */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
/* No folds in an empty buffer. */
|
/* No folds in an empty buffer. */
|
||||||
@ -1346,6 +1352,10 @@ set_curbuf(buf, action)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef FEAT_SYN_HL
|
||||||
|
if (prevbuf == curwin->w_buffer)
|
||||||
|
reset_synblock(curwin);
|
||||||
|
#endif
|
||||||
#ifdef FEAT_WINDOWS
|
#ifdef FEAT_WINDOWS
|
||||||
if (unload)
|
if (unload)
|
||||||
close_windows(prevbuf, FALSE);
|
close_windows(prevbuf, FALSE);
|
||||||
@ -1395,10 +1405,6 @@ enter_buffer(buf)
|
|||||||
foldUpdateAll(curwin); /* update folds (later). */
|
foldUpdateAll(curwin); /* update folds (later). */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_SYN_HL
|
|
||||||
reset_synblock(curwin);
|
|
||||||
curwin->w_s = &(buf->b_s);
|
|
||||||
#endif
|
|
||||||
/* Get the buffer in the current window. */
|
/* Get the buffer in the current window. */
|
||||||
curwin->w_buffer = buf;
|
curwin->w_buffer = buf;
|
||||||
curbuf = buf;
|
curbuf = buf;
|
||||||
@ -1409,6 +1415,10 @@ enter_buffer(buf)
|
|||||||
diff_buf_add(curbuf);
|
diff_buf_add(curbuf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FEAT_SYN_HL
|
||||||
|
curwin->w_s = &(buf->b_s);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Cursor on first line by default. */
|
/* Cursor on first line by default. */
|
||||||
curwin->w_cursor.lnum = 1;
|
curwin->w_cursor.lnum = 1;
|
||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
|
@ -3619,10 +3619,6 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
|
|||||||
*/
|
*/
|
||||||
check_arg_idx(curwin);
|
check_arg_idx(curwin);
|
||||||
|
|
||||||
#ifdef FEAT_SYN_HL
|
|
||||||
reset_synblock(curwin); /* remove any ownsyntax */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#ifdef FEAT_AUTOCMD
|
||||||
if (!auto_buf)
|
if (!auto_buf)
|
||||||
#endif
|
#endif
|
||||||
|
10
src/term.c
10
src/term.c
@ -3017,12 +3017,20 @@ set_shellsize(width, height, mustset)
|
|||||||
if (width < 0 || height < 0) /* just checking... */
|
if (width < 0 || height < 0) /* just checking... */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (State == HITRETURN || State == SETWSIZE) /* postpone the resizing */
|
if (State == HITRETURN || State == SETWSIZE)
|
||||||
{
|
{
|
||||||
|
/* postpone the resizing */
|
||||||
State = SETWSIZE;
|
State = SETWSIZE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* curwin->w_buffer can be NULL when we are closing a window and the
|
||||||
|
* buffer has already been closed and removing a scrollbar causes a resize
|
||||||
|
* event. Don't resize then, it will happen after entering another buffer.
|
||||||
|
*/
|
||||||
|
if (curwin->w_buffer == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
++busy;
|
++busy;
|
||||||
|
|
||||||
#ifdef AMIGA
|
#ifdef AMIGA
|
||||||
|
@ -709,6 +709,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
306,
|
||||||
/**/
|
/**/
|
||||||
305,
|
305,
|
||||||
/**/
|
/**/
|
||||||
|
20
src/window.c
20
src/window.c
@ -1226,15 +1226,15 @@ win_init(newp, oldp, flags)
|
|||||||
}
|
}
|
||||||
newp->w_tagstackidx = oldp->w_tagstackidx;
|
newp->w_tagstackidx = oldp->w_tagstackidx;
|
||||||
newp->w_tagstacklen = oldp->w_tagstacklen;
|
newp->w_tagstacklen = oldp->w_tagstacklen;
|
||||||
# ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
copyFoldingState(oldp, newp);
|
copyFoldingState(oldp, newp);
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
win_init_some(newp, oldp);
|
win_init_some(newp, oldp);
|
||||||
|
|
||||||
# ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
check_colorcolumn(newp);
|
check_colorcolumn(newp);
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2212,6 +2212,11 @@ win_close(win, free_buf)
|
|||||||
out_flush();
|
out_flush();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FEAT_SYN_HL
|
||||||
|
/* Free independent synblock before the buffer is freed. */
|
||||||
|
reset_synblock(win);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close the link to the buffer.
|
* Close the link to the buffer.
|
||||||
*/
|
*/
|
||||||
@ -2222,7 +2227,8 @@ win_close(win, free_buf)
|
|||||||
if (!win_valid(win) || last_window() || curtab != prev_curtab)
|
if (!win_valid(win) || last_window() || curtab != prev_curtab)
|
||||||
return;
|
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);
|
wp = win_free_mem(win, &dir, NULL);
|
||||||
|
|
||||||
/* Make sure curwin isn't invalid. It can cause severe trouble when
|
/* Make sure curwin isn't invalid. It can cause severe trouble when
|
||||||
@ -3247,6 +3253,9 @@ win_init_empty(wp)
|
|||||||
else
|
else
|
||||||
wp->w_farsi = W_CONV;
|
wp->w_farsi = W_CONV;
|
||||||
#endif
|
#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 */
|
#endif /* FEAT_GUI */
|
||||||
|
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
reset_synblock(wp); /* free independent synblock */
|
|
||||||
vim_free(wp->w_p_cc_cols);
|
vim_free(wp->w_p_cc_cols);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user