0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 7.4.1868

Problem:    Setting really_exiting causes memory leaks to be reported.
Solution:   Add the in_free_all_mem flag.
This commit is contained in:
Bram Moolenaar 2016-06-01 23:08:39 +02:00
parent 3c809343c7
commit b89a25f17e
4 changed files with 11 additions and 8 deletions

View File

@ -25350,8 +25350,9 @@ func_unref(char_u *name)
fp = find_func(name); fp = find_func(name);
if (fp == NULL) if (fp == NULL)
{ {
/* Ignore when invoked through free_all_mem(). */ #ifdef EXITFREE
if (!really_exiting) if (!entered_free_all_mem)
#endif
EMSG2(_(e_intern2), "func_unref()"); EMSG2(_(e_intern2), "func_unref()");
} }
else if (--fp->uf_refcount <= 0) else if (--fp->uf_refcount <= 0)

View File

@ -635,6 +635,10 @@ EXTERN int exiting INIT(= FALSE);
EXTERN int really_exiting INIT(= FALSE); EXTERN int really_exiting INIT(= FALSE);
/* TRUE when we are sure to exit, e.g., after /* TRUE when we are sure to exit, e.g., after
* a deadly signal */ * a deadly signal */
#if defined(EXITFREE)
EXTERN int entered_free_all_mem INIT(= FALSE);
/* TRUE when in or after free_all_mem() */
#endif
/* volatile because it is used in signal handler deathtrap(). */ /* volatile because it is used in signal handler deathtrap(). */
EXTERN volatile int full_screen INIT(= FALSE); EXTERN volatile int full_screen INIT(= FALSE);
/* TRUE when doing full-screen output /* TRUE when doing full-screen output

View File

@ -1036,16 +1036,12 @@ static void free_findfile(void);
free_all_mem(void) free_all_mem(void)
{ {
buf_T *buf, *nextbuf; buf_T *buf, *nextbuf;
static int entered = FALSE;
/* When we cause a crash here it is caught and Vim tries to exit cleanly. /* When we cause a crash here it is caught and Vim tries to exit cleanly.
* Don't try freeing everything again. */ * Don't try freeing everything again. */
if (entered) if (entered_free_all_mem)
return; return;
entered = TRUE; entered_free_all_mem = TRUE;
/* Set this flag to indicate some errors can be ignored. */
really_exiting = TRUE;
# ifdef FEAT_AUTOCMD # ifdef FEAT_AUTOCMD
/* Don't want to trigger autocommands from here on. */ /* Don't want to trigger autocommands from here on. */

View File

@ -753,6 +753,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 */
/**/
1868,
/**/ /**/
1867, 1867,
/**/ /**/