Bug in 7.0.178? redir => var makes vim crash (sometimes)
The following code makes vim crash sometimes.
redir => lets
It doesn't crash always. Sometimes I have to call the function twice.
I now ran a few more tests. It appears that vim is more likely to crash
when loading more plugins. When I remove plugins, I can call the
function more often. I'm not able to pin it down this problem to one
specific plugin though.
BTW, this is part of the following function:
redir => lets
let options = split(lets, "\n")
call filter(options, 'v:val =~ ''^[^_]\+_default\s''')
call map(options, 'matchstr(v:val, ''^[^_]\+\ze_default\s'')')
call filter(options, 'exists("&".v:val)')
let options = split(a:name, '\W\+')
for name in options
let name0 = 'g:'. name .'_default'
exec 'let &'. name .' = '. name0
command! -nargs=* ResetOption :call ResetOption(<q-args>)
Use it like this (eg to deal with misbehaving plugins changing global
let g:tabstop_default = 4
let &tabstop = g:tabstop_default
let &tabstop = 8
Unfortunately :set doesn't provide a way to (re)set user-defined default
values, it seems.
- Thomas wrote:
> The following code makes vim crash sometimes.I cannot reproduce it. Please have it crash in a debugger so that we
> fun! MakeVimCrash()
> redir => lets
> silent let
> redir END
> call MakeVimCrash()
> It doesn't crash always. Sometimes I have to call the function twice.
> I now ran a few more tests. It appears that vim is more likely to crash
> when loading more plugins. When I remove plugins, I can call the
> function more often. I'm not able to pin it down this problem to one
> specific plugin though.
can see where it happens.
Can you make it crash with "vim -u NONE"? If not then perhaps some of
your settings or startup scripts matter. Perhaps there is a variable
with a special value that causes a problem for ":let". E.g., a list or
dictionary with a recursive reference. Try ":unlet" (if you can
reproduce the crash).
Never under any circumstances take a sleeping pill
and a laxative on the same night.
/// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///