|
|
073263 |
To: vim_dev@googlegroups.com
|
|
|
073263 |
Subject: Patch 7.4.251
|
|
|
073263 |
Fcc: outbox
|
|
|
073263 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
073263 |
Mime-Version: 1.0
|
|
|
073263 |
Content-Type: text/plain; charset=UTF-8
|
|
|
073263 |
Content-Transfer-Encoding: 8bit
|
|
|
073263 |
------------
|
|
|
073263 |
|
|
|
073263 |
Patch 7.4.251
|
|
|
073263 |
Problem: Crash when BufAdd autocommand wipes out the buffer.
|
|
|
073263 |
Solution: Check for buffer to still be valid. Postpone freeing the buffer
|
|
|
073263 |
structure. (Hirohito Higashi)
|
|
|
073263 |
Files: src/buffer.c, src/ex_cmds.c, src/fileio.c, src/globals.h
|
|
|
073263 |
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.250/src/buffer.c 2014-03-23 15:12:29.907264336 +0100
|
|
|
073263 |
--- src/buffer.c 2014-04-06 19:55:53.563350929 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 676,683 ****
|
|
|
073263 |
#endif
|
|
|
073263 |
#ifdef FEAT_AUTOCMD
|
|
|
073263 |
aubuflocal_remove(buf);
|
|
|
073263 |
#endif
|
|
|
073263 |
! vim_free(buf);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
--- 676,691 ----
|
|
|
073263 |
#endif
|
|
|
073263 |
#ifdef FEAT_AUTOCMD
|
|
|
073263 |
aubuflocal_remove(buf);
|
|
|
073263 |
+ if (autocmd_busy)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ /* Do not free the buffer structure while autocommands are executing,
|
|
|
073263 |
+ * it's still needed. Free it when autocmd_busy is reset. */
|
|
|
073263 |
+ buf->b_next = au_pending_free_buf;
|
|
|
073263 |
+ au_pending_free_buf = buf;
|
|
|
073263 |
+ }
|
|
|
073263 |
+ else
|
|
|
073263 |
#endif
|
|
|
073263 |
! vim_free(buf);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1681,1687 ****
|
|
|
073263 |
--- 1689,1699 ----
|
|
|
073263 |
buf->b_p_bl = TRUE;
|
|
|
073263 |
#ifdef FEAT_AUTOCMD
|
|
|
073263 |
if (!(flags & BLN_DUMMY))
|
|
|
073263 |
+ {
|
|
|
073263 |
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf);
|
|
|
073263 |
+ if (!buf_valid(buf))
|
|
|
073263 |
+ return NULL;
|
|
|
073263 |
+ }
|
|
|
073263 |
#endif
|
|
|
073263 |
}
|
|
|
073263 |
return buf;
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1857,1864 ****
|
|
|
073263 |
--- 1869,1882 ----
|
|
|
073263 |
if (!(flags & BLN_DUMMY))
|
|
|
073263 |
{
|
|
|
073263 |
apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf);
|
|
|
073263 |
+ if (!buf_valid(buf))
|
|
|
073263 |
+ return NULL;
|
|
|
073263 |
if (flags & BLN_LISTED)
|
|
|
073263 |
+ {
|
|
|
073263 |
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf);
|
|
|
073263 |
+ if (!buf_valid(buf))
|
|
|
073263 |
+ return NULL;
|
|
|
073263 |
+ }
|
|
|
073263 |
# ifdef FEAT_EVAL
|
|
|
073263 |
if (aborting()) /* autocmds may abort script processing */
|
|
|
073263 |
return NULL;
|
|
|
073263 |
*** ../vim-7.4.250/src/ex_cmds.c 2014-04-04 19:00:46.351940169 +0200
|
|
|
073263 |
--- src/ex_cmds.c 2014-04-06 20:41:37.899356924 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 3343,3348 ****
|
|
|
073263 |
--- 3343,3354 ----
|
|
|
073263 |
#endif
|
|
|
073263 |
buf = buflist_new(ffname, sfname, 0L,
|
|
|
073263 |
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
|
|
|
073263 |
+ #ifdef FEAT_AUTOCMD
|
|
|
073263 |
+ /* autocommands may change curwin and curbuf */
|
|
|
073263 |
+ if (oldwin != NULL)
|
|
|
073263 |
+ oldwin = curwin;
|
|
|
073263 |
+ old_curbuf = curbuf;
|
|
|
073263 |
+ #endif
|
|
|
073263 |
}
|
|
|
073263 |
if (buf == NULL)
|
|
|
073263 |
goto theend;
|
|
|
073263 |
*** ../vim-7.4.250/src/fileio.c 2014-04-02 14:05:33.999887839 +0200
|
|
|
073263 |
--- src/fileio.c 2014-04-06 20:34:24.063355976 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 9548,9560 ****
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
* When stopping to execute autocommands, restore the search patterns and
|
|
|
073263 |
! * the redo buffer.
|
|
|
073263 |
*/
|
|
|
073263 |
if (!autocmd_busy)
|
|
|
073263 |
{
|
|
|
073263 |
restore_search_patterns();
|
|
|
073263 |
restoreRedobuff();
|
|
|
073263 |
did_filetype = FALSE;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
--- 9548,9566 ----
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
* When stopping to execute autocommands, restore the search patterns and
|
|
|
073263 |
! * the redo buffer. Free buffers in the au_pending_free_buf list.
|
|
|
073263 |
*/
|
|
|
073263 |
if (!autocmd_busy)
|
|
|
073263 |
{
|
|
|
073263 |
restore_search_patterns();
|
|
|
073263 |
restoreRedobuff();
|
|
|
073263 |
did_filetype = FALSE;
|
|
|
073263 |
+ while (au_pending_free_buf != NULL)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ buf_T *b = au_pending_free_buf->b_next;
|
|
|
073263 |
+ vim_free(au_pending_free_buf);
|
|
|
073263 |
+ au_pending_free_buf = b;
|
|
|
073263 |
+ }
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
*** ../vim-7.4.250/src/globals.h 2014-03-23 15:12:29.943264337 +0100
|
|
|
073263 |
--- src/globals.h 2014-04-06 20:32:58.339355789 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 386,391 ****
|
|
|
073263 |
--- 386,396 ----
|
|
|
073263 |
/* When deleting the current buffer, another one must be loaded. If we know
|
|
|
073263 |
* which one is preferred, au_new_curbuf is set to it */
|
|
|
073263 |
EXTERN buf_T *au_new_curbuf INIT(= NULL);
|
|
|
073263 |
+
|
|
|
073263 |
+ /* When deleting the buffer and autocmd_busy is TRUE, do not free the buffer
|
|
|
073263 |
+ * but link it in the list starting with au_pending_free_buf, using b_next.
|
|
|
073263 |
+ * Free the buffer when autocmd_busy is set to FALSE. */
|
|
|
073263 |
+ EXTERN buf_T *au_pending_free_buf INIT(= NULL);
|
|
|
073263 |
#endif
|
|
|
073263 |
|
|
|
073263 |
#ifdef FEAT_MOUSE
|
|
|
073263 |
*** ../vim-7.4.250/src/version.c 2014-04-05 21:59:35.939178415 +0200
|
|
|
073263 |
--- src/version.c 2014-04-06 19:52:46.887350521 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 736,737 ****
|
|
|
073263 |
--- 736,739 ----
|
|
|
073263 |
{ /* Add new patch number below this line */
|
|
|
073263 |
+ /**/
|
|
|
073263 |
+ 251,
|
|
|
073263 |
/**/
|
|
|
073263 |
|
|
|
073263 |
--
|
|
|
073263 |
hundred-and-one symptoms of being an internet addict:
|
|
|
073263 |
37. You start looking for hot HTML addresses in public restrooms.
|
|
|
073263 |
|
|
|
073263 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
073263 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
073263 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
073263 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|