comparison src/channel.c @ 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 472dc753e985
children d73d982499ae
comparison
equal deleted inserted replaced
19790:db735aadbcc2 19791:f46d3a9fe27d
4426 { 4426 {
4427 channel_T *channel = first_channel; 4427 channel_T *channel = first_channel;
4428 int ret = FALSE; 4428 int ret = FALSE;
4429 int r; 4429 int r;
4430 ch_part_T part = PART_SOCK; 4430 ch_part_T part = PART_SOCK;
4431 static int recursive = FALSE;
4431 #ifdef ELAPSED_FUNC 4432 #ifdef ELAPSED_FUNC
4432 elapsed_T start_tv; 4433 elapsed_T start_tv;
4433 4434 #endif
4435
4436 // The code below may invoke callbacks, which might call us back.
4437 // That doesn't work well, just return without doing anything.
4438 if (recursive)
4439 return FALSE;
4440 recursive = TRUE;
4441 ++safe_to_invoke_callback;
4442
4443 #ifdef ELAPSED_FUNC
4434 ELAPSED_INIT(start_tv); 4444 ELAPSED_INIT(start_tv);
4435 #endif 4445 #endif
4436
4437 ++safe_to_invoke_callback;
4438 4446
4439 // Only do this message when another message was given, otherwise we get 4447 // Only do this message when another message was given, otherwise we get
4440 // lots of them. 4448 // lots of them.
4441 if ((did_repeated_msg & REPEATED_MSG_LOOKING) == 0) 4449 if ((did_repeated_msg & REPEATED_MSG_LOOKING) == 0)
4442 { 4450 {
4511 channel_need_redraw = FALSE; 4519 channel_need_redraw = FALSE;
4512 redraw_after_callback(TRUE); 4520 redraw_after_callback(TRUE);
4513 } 4521 }
4514 4522
4515 --safe_to_invoke_callback; 4523 --safe_to_invoke_callback;
4524 recursive = FALSE;
4516 4525
4517 return ret; 4526 return ret;
4518 } 4527 }
4519 4528
4520 /* 4529 /*