Mercurial > vim
diff src/fileio.c @ 5816:29eb4c2a33ac v7.4.251
updated for version 7.4.251
Problem: Crash when BufAdd autocommand wipes out the buffer.
Solution: Check for buffer to still be valid. Postpone freeing the buffer
structure. (Hirohito Higashi)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 06 Apr 2014 20:45:43 +0200 |
parents | 410ef4f1a3d2 |
children | 1ee3fc5b40ae |
line wrap: on
line diff
--- a/src/fileio.c +++ b/src/fileio.c @@ -9548,13 +9548,19 @@ apply_autocmds_group(event, fname, fname /* * When stopping to execute autocommands, restore the search patterns and - * the redo buffer. + * the redo buffer. Free buffers in the au_pending_free_buf list. */ if (!autocmd_busy) { restore_search_patterns(); restoreRedobuff(); did_filetype = FALSE; + while (au_pending_free_buf != NULL) + { + buf_T *b = au_pending_free_buf->b_next; + vim_free(au_pending_free_buf); + au_pending_free_buf = b; + } } /*