comparison src/eval.c @ 14927:162d79d273e6 v8.1.0475

patch 8.1.0475: memory not freed on exit when quit in autocmd commit https://github.com/vim/vim/commit/27e80c885bcb5c5cf6a6462d71d6c81b06ba2451 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 14 21:41:01 2018 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Oct 2018 21:45:04 +0200
parents 0c845463a0db
children 2c0bfa167468
comparison
equal deleted inserted replaced
14926:f60f8f21f76f 14927:162d79d273e6
857 char_u *arg, 857 char_u *arg,
858 char_u **nextcmd, 858 char_u **nextcmd,
859 int use_sandbox) 859 int use_sandbox)
860 { 860 {
861 char_u *retval; 861 char_u *retval;
862 void *save_funccalp; 862 funccal_entry_T funccal_entry;
863 863
864 save_funccalp = save_funccal(); 864 save_funccal(&funccal_entry);
865 if (use_sandbox) 865 if (use_sandbox)
866 ++sandbox; 866 ++sandbox;
867 ++textlock; 867 ++textlock;
868 retval = eval_to_string(arg, nextcmd, FALSE); 868 retval = eval_to_string(arg, nextcmd, FALSE);
869 if (use_sandbox) 869 if (use_sandbox)
870 --sandbox; 870 --sandbox;
871 --textlock; 871 --textlock;
872 restore_funccal(save_funccalp); 872 restore_funccal();
873 return retval; 873 return retval;
874 } 874 }
875 875
876 /* 876 /*
877 * Top level evaluation function, returning a number. 877 * Top level evaluation function, returning a number.
8530 read_viminfo_varlist(vir_T *virp, int writing) 8530 read_viminfo_varlist(vir_T *virp, int writing)
8531 { 8531 {
8532 char_u *tab; 8532 char_u *tab;
8533 int type = VAR_NUMBER; 8533 int type = VAR_NUMBER;
8534 typval_T tv; 8534 typval_T tv;
8535 void *save_funccal; 8535 funccal_entry_T funccal_entry;
8536 8536
8537 if (!writing && (find_viminfo_parameter('!') != NULL)) 8537 if (!writing && (find_viminfo_parameter('!') != NULL))
8538 { 8538 {
8539 tab = vim_strchr(virp->vir_line + 1, '\t'); 8539 tab = vim_strchr(virp->vir_line + 1, '\t');
8540 if (tab != NULL) 8540 if (tab != NULL)
8579 vim_free(etv); 8579 vim_free(etv);
8580 } 8580 }
8581 } 8581 }
8582 8582
8583 /* when in a function use global variables */ 8583 /* when in a function use global variables */
8584 save_funccal = clear_current_funccal(); 8584 save_funccal(&funccal_entry);
8585 set_var(virp->vir_line + 1, &tv, FALSE); 8585 set_var(virp->vir_line + 1, &tv, FALSE);
8586 restore_current_funccal(save_funccal); 8586 restore_funccal();
8587 8587
8588 if (tv.v_type == VAR_STRING) 8588 if (tv.v_type == VAR_STRING)
8589 vim_free(tv.vval.v_string); 8589 vim_free(tv.vval.v_string);
8590 else if (tv.v_type == VAR_DICT || tv.v_type == VAR_LIST) 8590 else if (tv.v_type == VAR_DICT || tv.v_type == VAR_LIST)
8591 clear_tv(&tv); 8591 clear_tv(&tv);