Merge pull request #3630 from oni-link/fix.issue.3588

normal.c: No garbage collection while handling an event in normal mode
This commit is contained in:
Justin M. Keyes
2015-11-13 11:40:13 -05:00
3 changed files with 76 additions and 2 deletions

View File

@@ -42,8 +42,6 @@ void try_to_free_memory(void)
clear_sb_text();
// Try to save all buffers and release as many blocks as possible
mf_release_all();
// cleanup recursive lists/dicts
garbage_collect();
trying_to_free = false;
}

View File

@@ -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
}

View File

@@ -74,6 +74,72 @@ static char *features[] = {
// clang-format off
static int included_patches[] = {
916,
// 915,
// 914,
// 913,
// 912,
// 911,
// 910,
// 909,
// 908,
// 907,
// 906,
// 905,
// 904,
// 903,
// 902,
// 901,
// 900,
// 899,
// 898,
// 897,
// 896,
// 895,
// 894,
// 893,
// 892,
// 891,
// 890,
// 889,
// 888,
// 887,
// 886,
// 885,
// 884,
// 883,
// 882,
// 881,
// 880,
// 879,
// 878,
// 877,
// 876,
// 875,
// 874,
// 873,
// 872,
// 871,
// 870,
// 869,
// 868,
// 867,
// 866,
// 865,
// 864,
// 863,
// 862,
// 861,
// 860,
// 859,
// 858,
// 857,
// 856,
// 855,
// 854,
// 853,
// 852,
// 851,
// 850,
849,
// 848,