Christian Brabandt wrote:
> Hi Bram!
>
> On Fr, 24 Aug 2012, Bram Moolenaar wrote:
>
> >
> > Richard Brown wrote:
> >
> > > > > Hi, 7.3.449 fixed an issue where this autocommand and the following
> > > > > sequence would cause a segfault:
> > > > >
> > > > > :autocmd BufWinLeave * if empty(&bt) | lclose | endif
> > > > > :call setloclist(1, [{'bufnr': 1, 'lnum': 1, 'text': 'testing'}])
> > > > > :lopen
> > > > > ^wk
> > > > > :q
> > > > >
> > > >
> > > > Considering that 7.3.545 fixes a problem with autocommands, it's
> > > > unlikely that it introduced the problem, but rather uncovered another
> > > > problem.
> > > >
> > > > Does that sequence of commands segfault also for "vim -u NONE"?
> > > >
> > >
> > > Yes, I should have said that I was doing that, sorry. The backtrace didn't
> > > seem to offer much before, but here it is for Included patches: 1-638, 638
> > >
> > > Program received signal SIGSEGV, Segmentation fault.
> > > 0x00000001001553e5 in update_screen (type=40) at screen.c:478
> > > 478 if (wp->w_buffer->b_mod_set)
> > > (gdb) bt
> > > #0 0x00000001001553e5 in update_screen (type=40) at screen.c:478
> > > #1 0x00000001001def0f in main_loop (cmdwin=0, noexmode=0) at main.c:1197
> > > #2 0x00000001001debce in main (argc=3, argv=0x7fff5fbffbe8) at main.c:998
> >
> > At some point I decided to set w_buffer to NULL when it is no longer
> > valid. Previously there would be a dangling pointer that might still
> > work. This turns unpredictable behavior into a reliable crash :-).
> > Hopefully this is one such case and we can figure out how to fix it.
> > Most likely "wp" is no longer valid (I didn't look at the context yet).
>
> No, wp is perfectly valid.
>
> The problem is, when closing the current window, the autocommand closes
> the only other active window and we end up with wp->w_buffer == NULL. So
> wp->w_closing doesn't really help here.
>
> I have seen this crash several times already, but have never really had
> any idea how to prevent this. But I think, the attached patch fixes it
> altogether.
Thanks for looking into this and making a patch. I'll look into the
details soon.
--
The software said it requires Windows 95 or better, so I installed Linux.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
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