mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 01:38:16 +00:00
vim-patch:8.1.2197: ExitPre autocommand may cause accessing freed memory
Problem: ExitPre autocommand may cause accessing freed memory.
Solution: Check the window pointer is still valid. (closes vim/vim#5093)
34ba06b6e6
This commit is contained in:
@@ -6070,9 +6070,11 @@ static bool before_quit_autocmds(win_T *wp, bool quit_all, int forceit)
|
||||
if (quit_all
|
||||
|| (check_more(false, forceit) == OK && only_one_window())) {
|
||||
apply_autocmds(EVENT_EXITPRE, 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()
|
||||
// Refuse to quit when locked or when the window was closed or the
|
||||
// buffer in the last window is being closed (can only happen in
|
||||
// autocommands).
|
||||
if (!win_valid(wp)
|
||||
|| curbuf_locked()
|
||||
|| (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) {
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user