Mercurial > vim
changeset 19791:f46d3a9fe27d v8.2.0452
patch 8.2.0452: channel_parse_messages() fails when called recursively
Commit: https://github.com/vim/vim/commit/a9c3a30891edd7347d94298c48ea68bb5c165fd7
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 26 16:03:45 2020 +0100
patch 8.2.0452: channel_parse_messages() fails when called recursively
Problem: channel_parse_messages() fails when called recursively.
Solution: Return for a recursive call. (closes https://github.com/vim/vim/issues/5835)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 26 Mar 2020 16:15:03 +0100 |
parents | db735aadbcc2 |
children | 6bef434ae7ba |
files | src/channel.c src/version.c |
diffstat | 2 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -4428,14 +4428,22 @@ channel_parse_messages(void) int ret = FALSE; int r; ch_part_T part = PART_SOCK; + static int recursive = FALSE; #ifdef ELAPSED_FUNC elapsed_T start_tv; - +#endif + + // The code below may invoke callbacks, which might call us back. + // That doesn't work well, just return without doing anything. + if (recursive) + return FALSE; + recursive = TRUE; + ++safe_to_invoke_callback; + +#ifdef ELAPSED_FUNC ELAPSED_INIT(start_tv); #endif - ++safe_to_invoke_callback; - // Only do this message when another message was given, otherwise we get // lots of them. if ((did_repeated_msg & REPEATED_MSG_LOOKING) == 0) @@ -4513,6 +4521,7 @@ channel_parse_messages(void) } --safe_to_invoke_callback; + recursive = FALSE; return ret; }