I wrote:
> Christian Brabandt wrote:
>
> > Here are 3 patches that fix 2 particular problems with closing windows
> > while executing an autocommand.
> >
> > The first one is about Neovim issue 6308
> > (https://github.com/neovim/neovim/issues/6308)
> > which is about a crash on wipeing out buffers on SessionLoadPost
> > autocommand.
> >
> > I believe the reason is, that the autocommand removed one window in
> > another tabpage when executing the autocommand (and left the cursor in
> > that other tabpage). And in aucmd_restbuf we are left with a NULL
> > curwin, causing the segfault later on.
> >
> > While looking into it, I also noticed that when trying to close the
> > autocommand window in the autocommand and provoking E814, this will lead
> > to running into an endless loop, because in close_windows() Vim loops
> > over all windows and after calling win_close() it starts from the
> > beginning:
> >
> > ,----
> > | for (wp = firstwin; wp != NULL && !ONE_WINDOW; )
> > | {
> > | if (wp->w_buffer == buf && (!keep_curwin || wp != curwin)
> > | #ifdef FEAT_AUTOCMD
> > | && !(wp->w_closing || wp->w_buffer->b_locked > 0)
> > | #endif
> > | )
> > | {
> > | win_close(wp, FALSE);
> > |
> > | /* Start all over, autocommands may change the window layout. */
> > | wp = firstwin;
> > `----
> >
> > However, if win_close() returns an error and can't close the window the
> > loop will never return.
> > So fix this as well.
> >
> > And finally, the third patch adds a test for both bugs. Note if you run the
> > test with an unpatched Vim,
> > the endless loop bug will prevent it from terminating.
>
> Thanks.
>
> The call to win_valid() should be win_valid_any_tab(), since win_valid()
> only checks in the current tab.
>
> Closing windows should not happen with win_free_mem(). But that code
> won't do anything, since it's only called when there is no valid window.
> Thus we can remove closing windows.
Unfortunately the test hangs on Windows. Works fine on Linux. Strange.
I don't know how to fix this. I'll skip the test on win32 for now.
--
hundred-and-one symptoms of being an internet addict:
166. You have been on your computer soo long that you didn't realize
you had grandchildren.
/// 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
---
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.