]> granicus.if.org Git - vim/commitdiff
patch 8.2.0452: channel_parse_messages() fails when called recursively v8.2.0452
authorBram Moolenaar <Bram@vim.org>
Thu, 26 Mar 2020 15:03:45 +0000 (16:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 26 Mar 2020 15:03:45 +0000 (16:03 +0100)
Problem:    channel_parse_messages() fails when called recursively.
Solution:   Return for a recursive call. (closes #5835)

src/channel.c
src/version.c

index a57ed9ccf1a1073d331132b73ec3ef5e70e2f9fa..15ee0b775232d376ca23a2178dc1b97210d06c6b 100644 (file)
@@ -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;
 }
index 12e287dce598cdf6414e4f64cd64f6c7e23331e5..94fcb6096a94effaf95e32fa60f59d2cb717a407 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    452,
 /**/
     451,
 /**/