mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
normal.c: No garbage collection while handling an event in normal mode
Patch by @tarruda Fixes #3588
This commit is contained in:
@@ -7701,6 +7701,16 @@ static void nv_open(cmdarg_T *cap)
|
|||||||
// Handle an arbitrary event in normal mode
|
// Handle an arbitrary event in normal mode
|
||||||
static void nv_event(cmdarg_T *cap)
|
static void nv_event(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
|
// Garbage collection should have been executed before blocking for events in
|
||||||
|
// the `os_inchar` in `state_enter`, but we also disable it here in case the
|
||||||
|
// `os_inchar` branch was not executed(!queue_empty(loop.events), which could
|
||||||
|
// have `may_garbage_collect` set to true in `normal_check`).
|
||||||
|
//
|
||||||
|
// That is because here we may run code that calls `os_inchar`
|
||||||
|
// later(`f_confirm` or `get_keystroke` for example), but in these cases it is
|
||||||
|
// not safe to perform garbage collection because there could be unreferenced
|
||||||
|
// lists or dicts being used.
|
||||||
|
may_garbage_collect = false;
|
||||||
queue_process_events(loop.events);
|
queue_process_events(loop.events);
|
||||||
cap->retval |= CA_COMMAND_BUSY; // don't call edit() now
|
cap->retval |= CA_COMMAND_BUSY; // don't call edit() now
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user