mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4739: accessing freed memory after WinScrolled autocmd event (#18090)
Problem: Accessing freed memory after WinScrolled autocmd event.
Solution: Check the window pointer is still valid. (closes vim/vim#10156)
Remove the argument from may_trigger_winscrolled().
d58862d18f
This commit is contained in:
@@ -6,12 +6,14 @@ local eval = helpers.eval
|
||||
local command = helpers.command
|
||||
local feed = helpers.feed
|
||||
local meths = helpers.meths
|
||||
local assert_alive = helpers.assert_alive
|
||||
|
||||
before_each(clear)
|
||||
|
||||
describe('WinScrolled', function()
|
||||
local win_id
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
win_id = meths.get_current_win().id
|
||||
command(string.format('autocmd WinScrolled %d let g:matched = v:true', win_id))
|
||||
command('let g:scrolled = 0')
|
||||
@@ -72,3 +74,12 @@ describe('WinScrolled', function()
|
||||
eq(1, eval('g:scrolled'))
|
||||
end)
|
||||
end)
|
||||
|
||||
it('closing window in WinScrolled does not cause use-after-free #13265', function()
|
||||
local lines = {'aaa', 'bbb'}
|
||||
meths.buf_set_lines(0, 0, -1, true, lines)
|
||||
command('vsplit')
|
||||
command('autocmd WinScrolled * close')
|
||||
feed('<C-E>')
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user