Mirror of the Vim source from https://github.com/vim/vim
リビジョン | 49e38e5472e64ee713311d5d4e4fba0c150fb5ea (tree) |
---|---|
日時 | 2020-03-29 02:15:04 |
作者 | Bram Moolenaar <Bram@vim....> |
コミッター | Bram Moolenaar |
patch 8.2.0466: not parsing messages recursively breaks the govim plugin
Commit: https://github.com/vim/vim/commit/09c569038c42dcbdaa5c9b35fc9d1afbe5072cb4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 28 18:06:31 2020 +0100
@@ -4428,16 +4428,14 @@ | ||
4428 | 4428 | int ret = FALSE; |
4429 | 4429 | int r; |
4430 | 4430 | ch_part_T part = PART_SOCK; |
4431 | - static int recursive = FALSE; | |
4431 | + static int recursive = 0; | |
4432 | 4432 | #ifdef ELAPSED_FUNC |
4433 | 4433 | elapsed_T start_tv; |
4434 | 4434 | #endif |
4435 | 4435 | |
4436 | 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; | |
4437 | + // In a recursive call channels will not be closed. | |
4438 | + ++recursive; | |
4441 | 4439 | ++safe_to_invoke_callback; |
4442 | 4440 | |
4443 | 4441 | #ifdef ELAPSED_FUNC |
@@ -4454,33 +4452,37 @@ | ||
4454 | 4452 | } |
4455 | 4453 | while (channel != NULL) |
4456 | 4454 | { |
4457 | - if (channel_can_close(channel)) | |
4458 | - { | |
4459 | - channel->ch_to_be_closed = (1U << PART_COUNT); | |
4460 | - channel_close_now(channel); | |
4461 | - // channel may have been freed, start over | |
4462 | - channel = first_channel; | |
4463 | - continue; | |
4464 | - } | |
4465 | - if (channel->ch_to_be_freed || channel->ch_killing) | |
4455 | + if (recursive == 1) | |
4466 | 4456 | { |
4467 | - channel_free_contents(channel); | |
4468 | - if (channel->ch_job != NULL) | |
4469 | - channel->ch_job->jv_channel = NULL; | |
4470 | - | |
4471 | - // free the channel and then start over | |
4472 | - channel_free_channel(channel); | |
4473 | - channel = first_channel; | |
4474 | - continue; | |
4457 | + if (channel_can_close(channel)) | |
4458 | + { | |
4459 | + channel->ch_to_be_closed = (1U << PART_COUNT); | |
4460 | + channel_close_now(channel); | |
4461 | + // channel may have been freed, start over | |
4462 | + channel = first_channel; | |
4463 | + continue; | |
4464 | + } | |
4465 | + if (channel->ch_to_be_freed || channel->ch_killing) | |
4466 | + { | |
4467 | + channel_free_contents(channel); | |
4468 | + if (channel->ch_job != NULL) | |
4469 | + channel->ch_job->jv_channel = NULL; | |
4470 | + | |
4471 | + // free the channel and then start over | |
4472 | + channel_free_channel(channel); | |
4473 | + channel = first_channel; | |
4474 | + continue; | |
4475 | + } | |
4476 | + if (channel->ch_refcount == 0 && !channel_still_useful(channel)) | |
4477 | + { | |
4478 | + // channel is no longer useful, free it | |
4479 | + channel_free(channel); | |
4480 | + channel = first_channel; | |
4481 | + part = PART_SOCK; | |
4482 | + continue; | |
4483 | + } | |
4475 | 4484 | } |
4476 | - if (channel->ch_refcount == 0 && !channel_still_useful(channel)) | |
4477 | - { | |
4478 | - // channel is no longer useful, free it | |
4479 | - channel_free(channel); | |
4480 | - channel = first_channel; | |
4481 | - part = PART_SOCK; | |
4482 | - continue; | |
4483 | - } | |
4485 | + | |
4484 | 4486 | if (channel->ch_part[part].ch_fd != INVALID_FD |
4485 | 4487 | || channel_has_readahead(channel, part)) |
4486 | 4488 | { |
@@ -4521,7 +4523,7 @@ | ||
4521 | 4523 | } |
4522 | 4524 | |
4523 | 4525 | --safe_to_invoke_callback; |
4524 | - recursive = FALSE; | |
4526 | + --recursive; | |
4525 | 4527 | |
4526 | 4528 | return ret; |
4527 | 4529 | } |
@@ -739,6 +739,8 @@ | ||
739 | 739 | static int included_patches[] = |
740 | 740 | { /* Add new patch number below this line */ |
741 | 741 | /**/ |
742 | + 466, | |
743 | +/**/ | |
742 | 744 | 465, |
743 | 745 | /**/ |
744 | 746 | 464, |