mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
updated for version 7.3.557
Problem: Crash when an autocommand wipes out a buffer when it is hidden. Solution: Restore the current window when needed. (Christian Brabandt)
This commit is contained in:
21
src/buffer.c
21
src/buffer.c
@@ -1363,6 +1363,7 @@ set_curbuf(buf, action)
|
|||||||
int action;
|
int action;
|
||||||
{
|
{
|
||||||
buf_T *prevbuf;
|
buf_T *prevbuf;
|
||||||
|
win_T *prevwin;
|
||||||
int unload = (action == DOBUF_UNLOAD || action == DOBUF_DEL
|
int unload = (action == DOBUF_UNLOAD || action == DOBUF_DEL
|
||||||
|| action == DOBUF_WIPE);
|
|| action == DOBUF_WIPE);
|
||||||
|
|
||||||
@@ -1402,22 +1403,30 @@ set_curbuf(buf, action)
|
|||||||
if (buf_valid(prevbuf))
|
if (buf_valid(prevbuf))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
prevwin = curwin;
|
||||||
if (prevbuf == curbuf)
|
if (prevbuf == curbuf)
|
||||||
u_sync(FALSE);
|
u_sync(FALSE);
|
||||||
close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf,
|
close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf,
|
||||||
unload ? action : (action == DOBUF_GOTO
|
unload ? action : (action == DOBUF_GOTO
|
||||||
&& !P_HID(prevbuf)
|
&& !P_HID(prevbuf)
|
||||||
&& !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, FALSE);
|
&& !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, FALSE);
|
||||||
|
if (curwin != prevwin && win_valid(prevwin))
|
||||||
|
/* autocommands changed curwin, Grr! */
|
||||||
|
curwin = prevwin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
#ifdef FEAT_AUTOCMD
|
||||||
/* An autocommand may have deleted "buf", already entered it (e.g., when
|
/* An autocommand may have deleted "buf", already entered it (e.g., when
|
||||||
* it did ":bunload") or aborted the script processing! */
|
* it did ":bunload") or aborted the script processing!
|
||||||
# ifdef FEAT_EVAL
|
* If curwin->w_buffer is null, enter_buffer() will make it valid again */
|
||||||
if (buf_valid(buf) && buf != curbuf && !aborting())
|
if ((buf_valid(buf) && buf != curbuf
|
||||||
# else
|
#ifdef FEAT_EVAL
|
||||||
if (buf_valid(buf) && buf != curbuf)
|
&& !aborting()
|
||||||
# endif
|
#endif
|
||||||
|
#ifdef FEAT_WINDOWS
|
||||||
|
) || curwin->w_buffer == NULL
|
||||||
|
#endif
|
||||||
|
)
|
||||||
#endif
|
#endif
|
||||||
enter_buffer(buf);
|
enter_buffer(buf);
|
||||||
}
|
}
|
||||||
|
@@ -714,6 +714,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 */
|
||||||
|
/**/
|
||||||
|
557,
|
||||||
/**/
|
/**/
|
||||||
556,
|
556,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user