FS-6051 --resolve mod_rayo - double destroy of output component

This commit is contained in:
Chris Rienzo 2014-01-13 11:02:22 -05:00
parent db3f50d1ae
commit ff7428605a
3 changed files with 15 additions and 8 deletions

View File

@ -122,6 +122,8 @@ struct rayo_component {
const char *client_jid;
/** external ref */
const char *ref;
/** true if component has completed */
int complete;
/** optional cleanup */
rayo_actor_cleanup_fn cleanup_fn;
};

View File

@ -112,6 +112,7 @@ iks *rayo_component_create_complete_event(struct rayo_component *component, cons
*/
void rayo_component_send_complete_event(struct rayo_component *component, iks *response)
{
component->complete = 1;
RAYO_SEND_REPLY(component, iks_find_attrib(response, "to"), response);
RAYO_UNLOCK(component);
RAYO_DESTROY(component);

View File

@ -105,15 +105,19 @@ static iks *start_call_output(struct rayo_component *component, switch_core_sess
if (switch_ivr_displace_session(session, stream.data, 0, "m") == SWITCH_STATUS_SUCCESS) {
RAYO_UNLOCK(component);
} else {
if (OUTPUT_COMPONENT(component)->document) {
iks_delete(OUTPUT_COMPONENT(component)->document);
}
if (switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
rayo_component_send_complete(component, COMPONENT_COMPLETE_HANGUP);
component = NULL;
if (component->complete) {
/* component is already destroyed */
RAYO_UNLOCK(component);
} else {
rayo_component_send_complete(component, COMPONENT_COMPLETE_ERROR);
component = NULL;
/* need to destroy component */
if (OUTPUT_COMPONENT(component)->document) {
iks_delete(OUTPUT_COMPONENT(component)->document);
}
if (switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
rayo_component_send_complete(component, COMPONENT_COMPLETE_HANGUP);
} else {
rayo_component_send_complete(component, COMPONENT_COMPLETE_ERROR);
}
}
}
switch_safe_free(stream.data);