From 3075a45592fe76f2febb6321632a23e352efe949 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Nov 2021 15:51:52 +0000 Subject: patch 8.2.3609: internal error when ModeChanged is triggered recursively Problem: Internal error when ModeChanged is triggered when v:event is already in use. Solution: Save and restore v:event if needed. --- src/insexpand.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/insexpand.c') diff --git a/src/insexpand.c b/src/insexpand.c index c993d9670..e9b48616d 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -962,7 +962,7 @@ pum_enough_matches(void) return (i >= 2); } -#ifdef FEAT_EVAL +#if defined(FEAT_EVAL) || defined(PROTO) /* * Allocate Dict for the completed item. * { word, abbr, menu, kind, info } @@ -993,17 +993,18 @@ trigger_complete_changed_event(int cur) dict_T *v_event; dict_T *item; static int recursive = FALSE; + save_v_event_T save_v_event; if (recursive) return; - v_event = get_vim_var_dict(VV_EVENT); if (cur < 0) item = dict_alloc(); else item = ins_compl_dict_alloc(compl_curr_match); if (item == NULL) return; + v_event = get_v_event(&save_v_event); dict_add_dict(v_event, "completed_item", item); pum_set_event_info(v_event); dict_set_items_ro(v_event); @@ -1014,8 +1015,7 @@ trigger_complete_changed_event(int cur) textwinlock--; recursive = FALSE; - dict_free_contents(v_event); - hash_init(&v_event->dv_hashtab); + restore_v_event(v_event, &save_v_event); } #endif -- cgit v1.2.1