0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.0700: segfault with QuitPre autocommand closes the window

Problem:    Segfault with QuitPre autocommand closes the window. (Marek)
Solution:   Check that the window pointer is still valid. (Christian Brabandt,
            closes #1817)
This commit is contained in:
Bram Moolenaar
2017-07-08 14:44:50 +02:00
parent 710b4a1646
commit 0ea5070d79
3 changed files with 25 additions and 2 deletions

View File

@@ -7271,8 +7271,11 @@ ex_quit(exarg_T *eap)
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
/* Refuse to quit when locked or when the buffer in the last window is
* being closed (can only happen in autocommands). */
if (curbuf_locked() || (wp->w_buffer->b_nwindows == 1
&& wp->w_buffer->b_locked > 0))
if (curbuf_locked()
# ifdef FEAT_WINDOWS
|| !win_valid(wp)
# endif
|| (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0))
return;
#endif