]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.2.0252: Crash when ending Visual mode after curbuf was unloaded v9.2.0252
authorSean Dewar <6256228+seandewar@users.noreply.github.com>
Thu, 26 Mar 2026 20:05:31 +0000 (20:05 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 26 Mar 2026 20:05:31 +0000 (20:05 +0000)
commita8fdfd4fcb92b9fcbed3ad0a6769cb6bad34d965
treecfd7d37d4f38fb6c5c57b627d432ea78d8db00c5
parent68b3585e1db3a9e930b77cbce783b3507be4a3c0
patch 9.2.0252: Crash when ending Visual mode after curbuf was unloaded

Problem:  if close_buffer() in set_curbuf() unloads curbuf, NULL pointer
          accesses may occur from enter_buffer() calling
          end_visual_mode(), as curbuf is already abandoned and possibly
          unloaded.  Also, selection registers may not contain the
          selection with clipboard+=autoselect(plus).
Solution: Move close_buffer()'s end_visual_mode() call to buf_freeall(), after
          any autocmds that may restart it, but just before freeing anything
          (Sean Dewar)

related: #19728

Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/buffer.c
src/testdir/test_visual.vim
src/version.c