Problem: Use after free with redraw_listener_add() (after: v9.1.1976)
Solution: Copy Callbacks into listener struct (Foxe Chen)
closes: #18926
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
vim_free(rln);
return;
}
- set_callback(&rln->rl_callbacks.on_start, &cb);
+ copy_callback(&rln->rl_callbacks.on_start, &cb);
free_callback(&cb);
clear_tv(&tv);
got_one = true;
vim_free(rln);
return;
}
- set_callback(&rln->rl_callbacks.on_end, &cb);
+ copy_callback(&rln->rl_callbacks.on_end, &cb);
free_callback(&cb);
clear_tv(&tv);
got_one = true;
call StopVimInTerminal(buf)
endfunc
+func s:OnRedraw()
+endfunc
+
+" Test if partial is correctly ref'ed and doesn't cause use afte free error
+func Test_redraw_listener_partial()
+ call redraw_listener_add(#{on_start: function("s:OnRedraw", [1])})
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1982,
/**/
1981,
/**/