[vim/vim] Crash when deleting buffer after a nested autocommand gets buffer options using python (Issue #11631)

7 views
Skip to first unread message

zeertzjq

unread,
Nov 28, 2022, 4:21:37 AM11/28/22
to vim/vim, Subscribed

Steps to reproduce

  1. Run vim --clean
  2. Source the following file:
set hidden
edit Xa
edit Xb
call setline(1, 'bar')
enew
au BufWriteCmd Xb ++nested call setbufvar('Xa', '&ft', 'foo') | bw! Xa
au FileType foo call py3eval('vim.current.buffer.options["cindent"]')
wall
  1. Crash

Expected behaviour

No crash

Version of Vim

9.0.910

Environment

Operating system: Arch Linux
Terminal: kitty
Value of $TERM: xterm-kitty
Shell: fish

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11631@github.com>

zeertzjq

unread,
Nov 28, 2022, 4:23:44 AM11/28/22
to vim/vim, Subscribed

I haven't managed to build Vim from source with if_pyth, but I think this is related to these lines in aucmd_prepbuf():

    if (win == NULL && aucmd_win_used)
	// Strange recursive autocommand, fall back to using the current
	// window.  Expect a few side effects...
	win = curwin;


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11631/1328770465@github.com>

Bram Moolenaar

unread,
Nov 28, 2022, 6:19:26 AM11/28/22
to vim...@googlegroups.com, zeertzjq

> I haven't managed to build Vim from source with if_pyth, but I think this is related to these lines in `aucmd_prepbuf()`:
> ```c
> if (win == NULL && aucmd_win_used)
> // Strange recursive autocommand, fall back to using the current
> // window. Expect a few side effects...
> win = curwin;
> ```

Yes, I know that code isn't the right solution, and was thinking of the
need for more than one autocommand window. Now that you provide a repro
case I can look into implementing that.

--
"The question of whether computers can think is just like the question
of whether submarines can swim." -- Edsger W. Dijkstra

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

zeertzjq

unread,
Nov 28, 2022, 7:05:03 PM11/28/22
to vim/vim, Subscribed

Fixed by patch 9.0.0965


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11631/1329903149@github.com>

zeertzjq

unread,
Nov 28, 2022, 7:05:04 PM11/28/22
to vim/vim, Subscribed

Closed #11631 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/11631/issue_event/7907793796@github.com>

Reply all
Reply to author
Forward
0 new messages