aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroni-link <knil.ino@gmail.com>2015-11-09 17:54:49 +0100
committeroni-link <knil.ino@gmail.com>2015-11-13 15:59:46 +0100
commit1d9ae27e380159c1a2f98448feab48e9be0e56dd (patch)
treec6ce99e7674d5e55a8b579f641cca9b6bb972932
parent3f7f14c0c772302f48d9ebfa888bf970c469c041 (diff)
downloadrneovim-1d9ae27e380159c1a2f98448feab48e9be0e56dd.tar.gz
rneovim-1d9ae27e380159c1a2f98448feab48e9be0e56dd.tar.bz2
rneovim-1d9ae27e380159c1a2f98448feab48e9be0e56dd.zip
normal.c: No garbage collection while handling an event in normal mode
Patch by @tarruda Fixes #3588
-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
}