diff options
author | ZyX <kp-pav@yandex.ru> | 2017-01-06 22:57:34 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-01-06 22:57:34 +0300 |
commit | 10c6e68db6a96efd5ed4d06a48f029c18880a3c1 (patch) | |
tree | 53fb88e8eb5eceeb36a4c40442047e5654f3e01f /src/nvim/eval.c | |
parent | 6584fb723ad9fcdc96bbefdf79c638b840bc5655 (diff) | |
download | rneovim-10c6e68db6a96efd5ed4d06a48f029c18880a3c1.tar.gz rneovim-10c6e68db6a96efd5ed4d06a48f029c18880a3c1.tar.bz2 rneovim-10c6e68db6a96efd5ed4d06a48f029c18880a3c1.zip |
eval: Work with reference cycles in partials (self) properly
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index e31e3118fa..5fb6c04eb2 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19100,7 +19100,7 @@ static inline int _nothing_conv_func_start(typval_T *const tv, #define TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS(tv, len) #define TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, len) -static inline void _nothing_conv_func_end(typval_T *const tv) +static inline void _nothing_conv_func_end(typval_T *const tv, const int copyID) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL { if (tv->v_type == VAR_PARTIAL) { @@ -19109,7 +19109,9 @@ static inline void _nothing_conv_func_end(typval_T *const tv) return; } // Dictionaly should already be freed by the time. - assert(pt->pt_dict == NULL); + // If it was not freed then it is a part of the reference cycle. + assert(pt->pt_dict == NULL || pt->pt_dict->dv_copyID == copyID); + pt->pt_dict = NULL; // As well as all arguments. pt->pt_argc = 0; assert(pt->pt_refcount <= 1); @@ -19118,7 +19120,7 @@ static inline void _nothing_conv_func_end(typval_T *const tv) assert(tv->v_lock == VAR_UNLOCKED); } } -#define TYPVAL_ENCODE_CONV_FUNC_END(tv) _nothing_conv_func_end(tv) +#define TYPVAL_ENCODE_CONV_FUNC_END(tv) _nothing_conv_func_end(tv, copyID) #define TYPVAL_ENCODE_CONV_EMPTY_LIST(tv) \ do { \ |