diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-03-26 16:03:45 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-03-26 16:03:45 +0100 |
commit | a9c3a30891edd7347d94298c48ea68bb5c165fd7 (patch) | |
tree | 654fef67cc3e83391400502c362c7c064f70808a /src/channel.c | |
parent | 82e743c5b343847d88b958594ad3433213ef9405 (diff) | |
download | vim-git-a9c3a30891edd7347d94298c48ea68bb5c165fd7.tar.gz |
patch 8.2.0452: channel_parse_messages() fails when called recursivelyv8.2.0452
Problem: channel_parse_messages() fails when called recursively.
Solution: Return for a recursive call. (closes #5835)
Diffstat (limited to 'src/channel.c')
-rw-r--r-- | src/channel.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/channel.c b/src/channel.c index a57ed9ccf..15ee0b775 100644 --- 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; - - ELAPSED_INIT(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 + // 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; } |