0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.3.893

Problem:    Crash when using b:, w: or t: after closing the buffer, window or
            tabpage.
Solution:   Allocate the dictionary instead of having it part of the
            buffer/window/tabpage struct. (Yukihiro Nakadaira)
This commit is contained in:
Bram Moolenaar
2013-04-15 12:27:36 +02:00
parent 07219f911c
commit 429fa85392
7 changed files with 131 additions and 83 deletions

View File

@@ -648,6 +648,9 @@ free_buffer(buf)
buf_T *buf;
{
free_buffer_stuff(buf, TRUE);
#ifdef FEAT_EVAL
unref_var_dict(buf->b_vars);
#endif
#ifdef FEAT_LUA
lua_buffer_free(buf);
#endif
@@ -689,8 +692,8 @@ free_buffer_stuff(buf, free_options)
#endif
}
#ifdef FEAT_EVAL
vars_clear(&buf->b_vars.dv_hashtab); /* free all internal variables */
hash_init(&buf->b_vars.dv_hashtab);
vars_clear(&buf->b_vars->dv_hashtab); /* free all internal variables */
hash_init(&buf->b_vars->dv_hashtab);
#endif
#ifdef FEAT_USR_CMDS
uc_clear(&buf->b_ucmds); /* clear local user commands */
@@ -1694,6 +1697,17 @@ buflist_new(ffname, sfname, lnum, flags)
vim_free(ffname);
return NULL;
}
#ifdef FEAT_EVAL
/* init b: variables */
buf->b_vars = dict_alloc();
if (buf->b_vars == NULL)
{
vim_free(ffname);
vim_free(buf);
return NULL;
}
init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE);
#endif
}
if (ffname != NULL)
@@ -1778,10 +1792,6 @@ buflist_new(ffname, sfname, lnum, flags)
buf->b_wininfo->wi_fpos.lnum = lnum;
buf->b_wininfo->wi_win = curwin;
#ifdef FEAT_EVAL
/* init b: variables */
init_var_dict(&buf->b_vars, &buf->b_bufvar, VAR_SCOPE);
#endif
#ifdef FEAT_SYN_HL
hash_init(&buf->b_s.b_keywtab);
hash_init(&buf->b_s.b_keywtab_ic);