Mercurial > vim
comparison src/channel.c @ 18102:0d9ec3a2821f v8.1.2046
patch 8.1.2046: SafeState may be triggered at the wrong moment
Commit: https://github.com/vim/vim/commit/69198cb8c08f124729c41a4681f2d142228a9139
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 16 21:58:13 2019 +0200
patch 8.1.2046: SafeState may be triggered at the wrong moment
Problem: SafeState may be triggered at the wrong moment.
Solution: Move it up higher to after where messages are processed. Add a
SafeStateAgain event to tigger there.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 16 Sep 2019 22:00:04 +0200 |
parents | a2870e6f5b45 |
children | e59ff7b5d7a7 |
comparison
equal
deleted
inserted
replaced
18101:6d2d7e46c212 | 18102:0d9ec3a2821f |
---|---|
3591 chanpart_T *chanpart = &channel->ch_part[part]; | 3591 chanpart_T *chanpart = &channel->ch_part[part]; |
3592 int retval = FAIL; | 3592 int retval = FAIL; |
3593 | 3593 |
3594 ch_log(channel, "Blocking read JSON for id %d", id); | 3594 ch_log(channel, "Blocking read JSON for id %d", id); |
3595 | 3595 |
3596 // Not considered a safe state here, since we are processing a JSON message | |
3597 // and parsing other messages while waiting. | |
3598 enter_unsafe_state(); | |
3599 | |
3600 if (id >= 0) | 3596 if (id >= 0) |
3601 channel_add_block_id(chanpart, id); | 3597 channel_add_block_id(chanpart, id); |
3602 | 3598 |
3603 for (;;) | 3599 for (;;) |
3604 { | 3600 { |
3663 channel_read(channel, part, "channel_read_json_block"); | 3659 channel_read(channel, part, "channel_read_json_block"); |
3664 } | 3660 } |
3665 } | 3661 } |
3666 if (id >= 0) | 3662 if (id >= 0) |
3667 channel_remove_block_id(chanpart, id); | 3663 channel_remove_block_id(chanpart, id); |
3668 | |
3669 // This may trigger a SafeState autocommand. | |
3670 leave_unsafe_state(); | |
3671 | 3664 |
3672 return retval; | 3665 return retval; |
3673 } | 3666 } |
3674 | 3667 |
3675 /* | 3668 /* |