diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-28 19:28:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-28 19:28:59 +0100 |
commit | 707659490d35e8d66e8bbdcfd93b12dc1387d86c (patch) | |
tree | 8d74ae227a8ade4809c7da07183ccbcb7493f32c | |
parent | 1c39102666d2ccb998059bd7ada2d2efa31a11bc (diff) | |
download | vim-707659490d35e8d66e8bbdcfd93b12dc1387d86c.zip |
patch 7.4.1451
Problem: Vim hangs when a channel has a callback but isn't referenced.
Solution: Have channel_unref() only return TRUE when the channel was
actually freed.
-rw-r--r-- | src/channel.c | 7 | ||||
-rw-r--r-- | src/eval.c | 5 | ||||
-rw-r--r-- | src/proto/channel.pro | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/src/channel.c b/src/channel.c index c6f94ee2b..5e8c6bd81 100644 --- a/src/channel.c +++ b/src/channel.c @@ -334,12 +334,17 @@ channel_still_useful(channel_T *channel) * Close a channel and free all its resources if there is no further action * possible, there is no callback to be invoked or the associated job was * killed. + * Return TRUE if the channel was freed. */ - void + int channel_may_free(channel_T *channel) { if (!channel_still_useful(channel)) + { channel_free(channel); + return TRUE; + } + return FALSE; } /* diff --git a/src/eval.c b/src/eval.c index 4dd400ad9..a208b2a72 100644 --- a/src/eval.c +++ b/src/eval.c @@ -7747,10 +7747,7 @@ failret: channel_unref(channel_T *channel) { if (channel != NULL && --channel->ch_refcount <= 0) - { - channel_may_free(channel); - return TRUE; - } + return channel_may_free(channel); return FALSE; } #endif diff --git a/src/proto/channel.pro b/src/proto/channel.pro index 8dc4ad44d..5fd7f1405 100644 --- a/src/proto/channel.pro +++ b/src/proto/channel.pro @@ -4,7 +4,7 @@ int ch_log_active(void); void ch_log(channel_T *ch, char *msg); void ch_logs(channel_T *ch, char *msg, char *name); channel_T *add_channel(void); -void channel_may_free(channel_T *channel); +int channel_may_free(channel_T *channel); void channel_free(channel_T *channel); void channel_gui_register(channel_T *channel); void channel_gui_register_all(void); diff --git a/src/version.c b/src/version.c index d9697a8f9..86ed22317 100644 --- a/src/version.c +++ b/src/version.c @@ -744,6 +744,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1451, +/**/ 1450, /**/ 1449, |