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.
Files: src/eval.c, src/channel.c, src/proto/channel.pro
*** ../vim-7.4.1450/src/eval.c 2016-02-28 16:41:59.801677399 +0100
--- src/eval.c 2016-02-28 19:05:47.411995951 +0100
***************
*** 7747,7756 ****
channel_unref(channel_T *channel)
{
if (channel != NULL && --channel->ch_refcount <= 0)
! {
! channel_may_free(channel);
! return TRUE;
! }
return FALSE;
}
#endif
--- 7747,7753 ----
channel_unref(channel_T *channel)
{
if (channel != NULL && --channel->ch_refcount <= 0)
! return channel_may_free(channel);
return FALSE;
}
#endif
*** ../vim-7.4.1450/src/channel.c 2016-02-28 15:48:58.950599740 +0100
--- src/channel.c 2016-02-28 19:25:04.535921058 +0100
***************
*** 334,345 ****
* 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.
*/
! void
channel_may_free(channel_T *channel)
{
if (!channel_still_useful(channel))
channel_free(channel);
}
/*
--- 334,350 ----
* 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.
*/
! int
channel_may_free(channel_T *channel)
{
if (!channel_still_useful(channel))
+ {
channel_free(channel);
+ return TRUE;
+ }
+ return FALSE;
}
/*
*** ../vim-7.4.1450/src/proto/channel.pro 2016-02-25 23:10:12.041219969
+0100
--- src/proto/channel.pro 2016-02-28 19:06:47.131373002 +0100
***************
*** 4,10 ****
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);
void channel_free(channel_T *channel);
void channel_gui_register(channel_T *channel);
void channel_gui_register_all(void);
--- 4,10 ----
void ch_log(channel_T *ch, char *msg);
void ch_logs(channel_T *ch, char *msg, char *name);
channel_T *add_channel(void);
! 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);
*** ../vim-7.4.1450/src/version.c 2016-02-28 18:03:55.690659915 +0100
--- src/version.c 2016-02-28 19:05:23.480245599 +0100
***************
*** 745,746 ****
--- 745,748 ----
{ /* Add new patch number below this line */
+ /**/
+ 1451,
/**/
--
The MS-Windows registry is no more hostile than any other bunch of state
information... that is held in a binary format... a format that nobody
understands... and is replicated and cached in a complex and largely
undocumented way... and contains large amounts of duplicate and obfuscated
information... (Ben Peterson)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.