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 committed 2009-03-24 15:30:08 +00:00
1 parent 80e6a1bd0f
commit 4025b42470
15 files changed
+280 -27

No files matched your search

@@ -21,16 +21,25 @@ Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
}
static switch_status_t python_hanguphook(switch_core_session_t *session_hungup);
Session::~Session()
void Session::destroy(void)
{
if (hangup_func) {
if (session) {
switch_core_event_hook_remove_state_change(session, python_hanguphook);
}
Py_DECREF(hangup_func);
hangup_func = NULL;
if (!allocated) {
return;
}
if (session) {
if (!channel) {
channel = switch_core_session_get_channel(session);
}
switch_channel_set_private(channel, "CoreSession", NULL);
switch_core_event_hook_remove_state_change(session, python_hanguphook);
}
if (hangup_func) {
Py_DECREF(hangup_func);
hangup_func = NULL;
}
if (hangup_func_arg) {
Py_DECREF(hangup_func_arg);
@@ -49,7 +58,14 @@ Session::~Session()
if (Self) {
Py_DECREF(Self);
}
}
CoreSession::destroy();
}
Session::~Session()
{
destroy();
}
bool Session::begin_allow_threads()