Skip to content

Instantly share code, notes, and snippets.

@mattn
Created March 24, 2020 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/8cb49a86b74559a10bccd753785e42d3 to your computer and use it in GitHub Desktop.
Save mattn/8cb49a86b74559a10bccd753785e42d3 to your computer and use it in GitHub Desktop.
diff --git a/src/channel.c b/src/channel.c
index 6dde107bf..fdb115a11 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -4431,6 +4431,7 @@ channel_parse_messages(void)
ELAPSED_INIT(start_tv);
#endif
+ static int freeing = FALSE;
++safe_to_invoke_callback;
@@ -4452,16 +4453,16 @@ channel_parse_messages(void)
channel = first_channel;
continue;
}
- if (channel->ch_to_be_freed || channel->ch_killing)
+ if ((channel->ch_to_be_freed || channel->ch_killing) && freeing == FALSE)
{
if (channel->ch_killing)
{
+ freeing = TRUE;
channel_free_contents(channel);
- channel_free_channel(channel);
+ freeing = FALSE;
channel->ch_job->jv_channel = NULL;
}
- else
- channel_free(channel);
+ channel_free(channel);
// channel has been freed, start over
channel = first_channel;
continue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment