aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2015-11-13 11:40:13 -0500
committerJustin M. Keyes <justinkz@gmail.com>2015-11-13 11:40:13 -0500
commit4cfda1ff7d1aa75b67aed5566f39a390939da3f6 (patch)
treec55f40cb88ad16150dee826bfc20f78771235b5a /src/nvim/normal.c
parent08a1eb7ae1bb687dec51c9b0b9630b6ae6d1c263 (diff)
parent1c43452afcada9b7163e33d47c7b6bdaf82abded (diff)
downloadrneovim-4cfda1ff7d1aa75b67aed5566f39a390939da3f6.tar.gz
rneovim-4cfda1ff7d1aa75b67aed5566f39a390939da3f6.tar.bz2
rneovim-4cfda1ff7d1aa75b67aed5566f39a390939da3f6.zip
Merge pull request #3630 from oni-link/fix.issue.3588
normal.c: No garbage collection while handling an event in normal mode
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index fce3558e9f..d6bc416c91 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -7701,6 +7701,16 @@ static void nv_open(cmdarg_T *cap)
// Handle an arbitrary event in normal mode
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);
cap->retval |= CA_COMMAND_BUSY; // don't call edit() now
}