fix hanguphook order of operations vs destroy method issue in c++ code

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12730 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-03-24 15:30:08 +00:00
parent 80e6a1bd0f
commit 4025b42470
15 changed files with 280 additions and 27 deletions

View File

@@ -887,6 +887,10 @@ SWITCH_DECLARE(bool) CoreSession::answered() {
SWITCH_DECLARE(void) CoreSession::destroy(void)
{
this_check_void();
if (!allocated) {
return;
}
switch_safe_free(xml_cdr_text);
switch_safe_free(uuid);
@@ -903,7 +907,7 @@ SWITCH_DECLARE(void) CoreSession::destroy(void)
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "destroy/unlink session from object\n");
if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
@@ -912,7 +916,7 @@ SWITCH_DECLARE(void) CoreSession::destroy(void)
channel = NULL;
}
allocated = 0;
init_vars();
}