]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1451 v7.4.1451
authorBram Moolenaar <Bram@vim.org>
Sun, 28 Feb 2016 18:28:59 +0000 (19:28 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 28 Feb 2016 18:28:59 +0000 (19:28 +0100)
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.

src/channel.c
src/eval.c
src/proto/channel.pro
src/version.c

index c6f94ee2b9dc9e8284da18f24f1c36599eab2b22..5e8c6bd8144e36ec5b6926f377ba16f91f14a495 100644 (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
  * 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;
 }
 
 /*
index 4dd400ad98bff622471ac3817b88218a205cee2c..a208b2a727e88e5a79bde0359fb21b536d5a59ae 100644 (file)
@@ -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
index 8dc4ad44d1ad81da32b80096c185d50c794ae694..5fd7f1405e47e5860978956eda64b04ce846464c 100644 (file)
@@ -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);
index d9697a8f9635bcf8a286458b4a185fb06dfd5587..86ed2231776f0f692b937b7e959267180f228420 100644 (file)
@@ -743,6 +743,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1451,
 /**/
     1450,
 /**/