Ah the joys of programming. Like spending 3 hours tracking down an elusive segfault :(
Today I managed to crash Vim with a custom ruby-based plugin I’m writing. I can’t find any solutions on the web and don’t have time for a full day of gdb coredump debugging but managed to narrow down the culprit. Posting this in case someone else encounters a similar situation — and drop me a line if you do!
Here is the helpful information that Vim spit out:
Vim: Caught deadly signal SEGV Vim: Finished.
This is the ruby code initiating the segfault (line 27):
26 c.each_index do |i|^ 27 VIM::Buffer.current.append(i, c[i])^ 28 end^
Here is the vimscript used to create a new buffer into which the above line tries to add new lines:
241 " launch new buffer^
242 exec "silent botright new"^
243 " create a 'scratch' buffer that cannot be saved^
244 setlocal nobuflisted^
245 setlocal noswapfile^
246 setlocal buftype=nofile^
247 setlocal bufhidden=wipe^
248 setlocal nolist^
249 setlocal nonumber^
250 setlocal foldcolumn=0 nofoldenable^
251 setlocal showbreak=>>^
252 setlocal wrap^
253 if has('syntax') | setlocal syntax=rally | endif^
Turns out that removing the bufhidden=wipe setting solves the segfault crash. So something with the ruby VIM::Buffer.current is conflicting with that setting. I’m not sure what… but at least i’m not choking anymore.
I’ll followup if I get clarity on this situation…