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
+14 -5
View File
@@ -21,8 +21,14 @@ Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
hh = mark = 0;
}
static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup);
Session::~Session()
void Session::destroy(void)
{
if (!allocated) {
return;
}
if (session) {
if (!channel) {
@@ -30,8 +36,6 @@ Session::~Session()
}
switch_channel_set_private(channel, "CoreSession", NULL);
switch_core_event_hook_remove_state_change(session, lua_hanguphook);
session = NULL;
channel = NULL;
}
switch_safe_free(hangup_func_str);
@@ -39,8 +43,13 @@ Session::~Session()
switch_safe_free(cb_function);
switch_safe_free(cb_arg);
init_vars();
CoreSession::destroy();
}
Session::~Session()
{
destroy();
}
bool Session::begin_allow_threads()
@@ -23,6 +23,7 @@ class Session : public CoreSession {
Session(char *uuid, CoreSession *a_leg = NULL);
Session(switch_core_session_t *session);
~Session();
virtual void destroy(void);
virtual bool begin_allow_threads();
virtual bool end_allow_threads();
@@ -40,6 +41,7 @@ class Session : public CoreSession {
char *hangup_func_str;
char *hangup_func_arg;
void setLUA(lua_State *state);
};
}
#endif
@@ -7388,6 +7388,30 @@ fail:
}
static int _wrap_Session_destroy(lua_State* L) {
int SWIG_arg = -1;
LUA::Session *arg1 = (LUA::Session *) 0 ;
SWIG_check_num_args("destroy",1,1)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("destroy",1,"LUA::Session *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
SWIG_fail_ptr("Session_destroy",1,SWIGTYPE_p_LUA__Session);
}
(arg1)->destroy();
SWIG_arg=0;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_Session_begin_allow_threads(lua_State* L) {
int SWIG_arg = -1;
LUA::Session *arg1 = (LUA::Session *) 0 ;
@@ -8086,6 +8110,7 @@ LUA::Session *arg1 = (LUA::Session *) obj;
delete arg1;
}
static swig_lua_method swig_LUA_Session_methods[] = {
{"destroy", _wrap_Session_destroy},
{"begin_allow_threads", _wrap_Session_begin_allow_threads},
{"end_allow_threads", _wrap_Session_end_allow_threads},
{"check_hangup_hook", _wrap_Session_check_hangup_hook},