mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.0475: memory not freed on exit when quit in autocmd
Problem: Memory not freed on exit when quit in autocmd. Solution: Remember funccal stack when executing autocmd.
This commit is contained in:
20
src/main.c
20
src/main.c
@@ -1717,7 +1717,7 @@ get_number_arg(
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for: [r][e][g][vi|vim|view][diff][ex[im]]
|
||||
* Check for: [r][e][g][vi|vim|view][diff][ex[im]] (sort of)
|
||||
* If the executable name starts with "r" we disable shell commands.
|
||||
* If the next character is "e" we run in Easy mode.
|
||||
* If the next character is "g" we run the GUI version.
|
||||
@@ -1788,7 +1788,7 @@ parse_command_name(mparm_T *parmp)
|
||||
else if (STRNICMP(initstr, "vim", 3) == 0)
|
||||
initstr += 3;
|
||||
|
||||
/* Catch "[r][g]vimdiff" and "[r][g]viewdiff". */
|
||||
// Catch "[r][g]vimdiff" and "[r][g]viewdiff".
|
||||
if (STRICMP(initstr, "diff") == 0)
|
||||
{
|
||||
#ifdef FEAT_DIFF
|
||||
@@ -1800,13 +1800,15 @@ parse_command_name(mparm_T *parmp)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Checking for "ex" here may catch some weir names, such as "vimex" or
|
||||
// "viewex", we assume the user knows that.
|
||||
if (STRNICMP(initstr, "ex", 2) == 0)
|
||||
{
|
||||
if (STRNICMP(initstr + 2, "im", 2) == 0)
|
||||
exmode_active = EXMODE_VIM;
|
||||
else
|
||||
exmode_active = EXMODE_NORMAL;
|
||||
change_compatible(TRUE); /* set 'compatible' */
|
||||
change_compatible(TRUE); // set 'compatible'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4188,12 +4190,16 @@ eval_client_expr_to_string(char_u *expr)
|
||||
char_u *res;
|
||||
int save_dbl = debug_break_level;
|
||||
int save_ro = redir_off;
|
||||
void *fc = NULL;
|
||||
funccal_entry_T funccal_entry;
|
||||
int did_save_funccal = FALSE;
|
||||
|
||||
/* Evaluate the expression at the toplevel, don't use variables local to
|
||||
* the calling function. Except when in debug mode. */
|
||||
if (!debug_mode)
|
||||
fc = clear_current_funccal();
|
||||
{
|
||||
save_funccal(&funccal_entry);
|
||||
did_save_funccal = TRUE;
|
||||
}
|
||||
|
||||
/* Disable debugging, otherwise Vim hangs, waiting for "cont" to be
|
||||
* typed. */
|
||||
@@ -4210,8 +4216,8 @@ eval_client_expr_to_string(char_u *expr)
|
||||
--emsg_silent;
|
||||
if (emsg_silent < 0)
|
||||
emsg_silent = 0;
|
||||
if (fc != NULL)
|
||||
restore_current_funccal(fc);
|
||||
if (did_save_funccal)
|
||||
restore_funccal();
|
||||
|
||||
/* A client can tell us to redraw, but not to display the cursor, so do
|
||||
* that here. */
|
||||
|
Reference in New Issue
Block a user