fix(ui): avoid recursiveness and invalid memory access #28578

Problem:  Calling :redraw from vim.ui_attach() callback results in
          recursive cmdline/message events.
Solution: Avoid recursiveness where possible and replace global "call_buf"
          with separate, temporary buffers for each event so that when a Lua
          callback for one event fires another event, that does not result
          in invalid memory access.
This commit is contained in:
luukvbaal
2024-05-01 22:51:06 +02:00
committed by GitHub
parent 631d5189ad
commit e778e01161
9 changed files with 92 additions and 65 deletions

View File

@@ -63,7 +63,6 @@ typedef struct {
PackerBuffer packer;
const char *cur_event; ///< name of current event (might get multiple arglists)
Array call_buf; ///< buffer for constructing a single arg list (max 16 elements!)
// We start packing the two outermost msgpack arrays before knowing the total
// number of elements. Thus track the location where array size will need