diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-04-15 12:27:36 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-04-15 12:27:36 +0200 |
commit | 429fa85392a934b34ba7b394558900cbb8786454 (patch) | |
tree | 2efc8dbb0c4727471c970f4c96ea37a9e9ba67e6 /src/buffer.c | |
parent | 07219f911c86a50840050282baafe896284a5588 (diff) | |
download | vim-git-429fa85392a934b34ba7b394558900cbb8786454.tar.gz |
updated for version 7.3.893v7.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)
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c index 2a9fe4d12..5ee629990 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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); |