aboutsummaryrefslogtreecommitdiffstats
path: root/main/channel.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-14 14:58:02 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-14 14:58:02 +0000
commitade38fc06cbeb9b0544c701c8bdca21fda7e39fe (patch)
treedbadb66040c5e8969a3fc56d413e773e17f379e9 /main/channel.c
parentaa892cd0802282749dc31d2e800e340a188fc8d2 (diff)
Save a local copy of the generate callback prior to unlocking the channel in
case the generate callback goes NULL on us after the channel is unlocked. Thanks to Russell for pointing this need out to me. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@114106 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index bdad4413c..ff8277746 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1887,6 +1887,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
{
if (chan->generatordata && !ast_internal_timing_enabled(chan)) {
void *tmp = chan->generatordata;
+ int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples) = NULL;
int res;
if (chan->timingfunc) {
@@ -1896,6 +1897,9 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
}
chan->generatordata = NULL; /* reset, to let writes go through */
+ if (chan->generator->generate) {
+ generate = chan->generator->generate;
+ }
/* This unlock is here based on two assumptions that hold true at this point in the
* code. 1) this function is only called from within __ast_read() and 2) all generators
* call ast_write() in their generate callback.
@@ -1905,7 +1909,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
* avoidance not to work in deeper functions
*/
ast_channel_unlock(chan);
- res = chan->generator->generate(chan, tmp, f->datalen, f->samples);
+ res = generate(chan, tmp, f->datalen, f->samples);
ast_channel_lock(chan);
chan->generatordata = tmp;
if (res) {