0
0
mirror of https://github.com/vim/vim.git synced 2025-07-24 10:45:12 -04:00

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.
This commit is contained in:
Bram Moolenaar 2016-02-28 19:28:59 +01:00
parent 1c39102666
commit 707659490d
4 changed files with 10 additions and 6 deletions

View File

@ -334,12 +334,17 @@ channel_still_useful(channel_T *channel)
* Close a channel and free all its resources if there is no further action * 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 * possible, there is no callback to be invoked or the associated job was
* killed. * killed.
* Return TRUE if the channel was freed.
*/ */
void int
channel_may_free(channel_T *channel) channel_may_free(channel_T *channel)
{ {
if (!channel_still_useful(channel)) if (!channel_still_useful(channel))
{
channel_free(channel); channel_free(channel);
return TRUE;
}
return FALSE;
} }
/* /*

View File

@ -7747,10 +7747,7 @@ failret:
channel_unref(channel_T *channel) channel_unref(channel_T *channel)
{ {
if (channel != NULL && --channel->ch_refcount <= 0) if (channel != NULL && --channel->ch_refcount <= 0)
{ return channel_may_free(channel);
channel_may_free(channel);
return TRUE;
}
return FALSE; return FALSE;
} }
#endif #endif

View File

@ -4,7 +4,7 @@ int ch_log_active(void);
void ch_log(channel_T *ch, char *msg); void ch_log(channel_T *ch, char *msg);
void ch_logs(channel_T *ch, char *msg, char *name); void ch_logs(channel_T *ch, char *msg, char *name);
channel_T *add_channel(void); 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_free(channel_T *channel);
void channel_gui_register(channel_T *channel); void channel_gui_register(channel_T *channel);
void channel_gui_register_all(void); void channel_gui_register_all(void);

View File

@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1451,
/**/ /**/
1450, 1450,
/**/ /**/