From: Luke Dashjr Date: Thu, 17 Mar 2011 20:32:47 +0000 (-0500) Subject: MERGE: Bugfix: Destroy schannel only *after* cleanup of its contents is done X-Git-Tag: v1.2-rc1~171^2~22^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1809ce5d83b16d5c0909e6f8fb72a85635364abd;p=thirdparty%2Ffreeswitch.git MERGE: Bugfix: Destroy schannel only *after* cleanup of its contents is done --- 1809ce5d83b16d5c0909e6f8fb72a85635364abd diff --cc src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 8698e4a02c,63264a0049..ed34f34989 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@@ -3155,19 -3118,15 +3155,19 @@@ static switch_status_t recog_asr_disabl static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags) { speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - speech_channel_stop(schannel); - switch_core_hash_destroy(&r->grammars); - switch_core_hash_destroy(&r->enabled_grammars); - if (r->dtmf_generator) { - mpf_dtmf_generator_destroy(r->dtmf_generator); - } - speech_channel_destroy(schannel); + recognizer_data_t *r = NULL; + /* close if not already closed */ + if (schannel != NULL && !switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) { + r = (recognizer_data_t *) schannel->data; + speech_channel_stop(schannel); - speech_channel_destroy(schannel); + switch_core_hash_destroy(&r->grammars); + switch_core_hash_destroy(&r->enabled_grammars); + if (r->dtmf_generator) { + mpf_dtmf_generator_destroy(r->dtmf_generator); + } ++ speech_channel_destroy(schannel); + } /* this lets FreeSWITCH's speech_thread know the handle is closed */ switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);