Loading ...
Sorry, an error occurred while loading the content.

Re: vim segfault on :cclose in BufUnload (with python?)

Expand Messages
  • Christian Brabandt
    Hi Bram! ... Here is a small updated patch. unsaved changes shouldn t be a problem in this case, since we are explicitly checking that the buffer is null.
    Message 1 of 4 , Dec 18, 2012
    • 0 Attachment
      Hi Bram!

      On Di, 18 Dez 2012, Bram Moolenaar wrote:

      >
      > Christian Brabandt wrote:
      >
      > > On Mo, 17 Dez 2012, Sean Reifschneider wrote:
      > >
      > > > Since vim 7.3 patch 429 (on Ubuntu Precise/12.04), it looks like there's a segfault issue when doing "cclose" on BufUnload in a python function. In particular, it happens on 7.3 patch 547 (Ubuntu Quantal/12.10), and is also happening on 7.3 patch 762 (latest tag in Mercurial checkout).
      > > >
      > > > Here's how I'm able to reproduce it:
      > > >
      > > > Create a file /tmp/blowup.vim:
      > > >
      > > > pyfile /tmp/blowup.py
      > > > botright 3copen
      > > > autocmd BufUnload * python leaving_buffer()
      > > >
      > > > Then create a file /tmp/blowup.py:
      > > >
      > > > import vim
      > > > def leaving_buffer():
      > > > vim.command('cclose')
      > > > vim.command('quit')
      > > >
      > > > Now run "vim -u tmp/blowup.vim /tmp/foo" (in my case, /tmp/foo does not exist). Do ":q" in vim, and it will segfault:
      > > >
      > > > Vim: Caught deadly signal SEGV
      > > > zsh: segmentation fault (core dumped) vim -u /tmp/blowup.vim /tmp/foo
      > > >
      > >
      > > This is an issue, that seems to come up in one or another form every
      > > couple of months here. The root cause is always autocommands closing all
      > > windows and buffers, which Vim does not expect and so it crashes sooner
      > > or later. Here is a patch, trying to prevent this another time:
      >
      > Thanks Christian, added to the todo list.
      > Note that I am travelling, expect some delay.
      >
      >
      > > This does quit Vim, in case an autocommand closes all other
      > > windows/buffers while Vim is processing the win_close() function.
      >
      > What if there are unsaved changes?

      Here is a small updated patch. unsaved changes shouldn't be a problem in
      this case, since we are explicitly checking that the buffer is null.


      regards,
      Christian
      --
      Man ist nur vielseitig, wenn man zum Höchsten strebt, weil man
      muss (im Ernst), und zum Geringern herabsteigt, wenn man will (zum
      Spaß).
      -- Goethe, Maximen und Reflektionen, Nr. 1157

      --
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.