On Saturday, July 8, 2017 at 4:38:36 PM UTC-4, Bram Moolenaar wrote:
> Patch 8.0.0702
> Problem: An error in a timer can make Vim unusable.
> Solution: Don't set the error flag or exception from a timer. Stop a timer
> if it causes an error 3 out of 3 times. Discard an exception
> caused inside a timer.
> Files: src/ex_cmds2.c, src/structs.h, src/testdir/test_timers.vim,
> runtime/doc/eval.txt
This patch is causing segfaults for me. I've built with and without it to
verify.
I have a timer to check a couple files and update my color scheme when they
change. I haven't tried to narrow down any specific lines yet, but when
TryTheme actually triggers then vim segfaults immediately. Maybe because of the
try/catch?
Here's the code from my vimrc:
function! TryTheme(theme, ...)
let l:background = a:0 ? a:1 : ''
if a:theme == 'solarized'
" force dark bg to prevent double toggle with term scheme
let l:background = 'dark'
endif
if exists('g:colors_name') && g:colors_name == a:theme &&
\ empty(l:background) || &background == l:background
return 1
endif
try
exec 'colorscheme' a:theme
catch /^Vim\%((\a\+)\)\=:E185/
return 0
endtry
if ! empty(l:background)
let &background = l:background
endif
if exists('syntax_on')
syn reset
endif
endfunction
function! LoadTheme()
let l:background_file = expand('~/.vim/background')
let l:theme_file = expand('~/.vim/theme')
let l:background = filereadable(l:background_file) ?
\ readfile(l:background_file)[0] : &background
let l:theme = filereadable(l:theme_file) ?
\ readfile(l:theme_file)[0] : 'default'
if l:background == &background &&
\ exists('g:colors_name') && l:theme == g:colors_name
return 0
endif
" echom l:theme . " " . l:background
call TryTheme(l:theme, l:background)
endfunction
call LoadTheme()
if has("timers")
function! LoadThemeTimer(timer)
call LoadTheme()
endfunction
let theme_timer = timer_start(1000, 'LoadThemeTimer', {'repeat': -1})
endif
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.