Dear All,
I am using connect in order to send a SIGNAL with 2 variables towards a SLOT. The connect looks like this:
const bool connected
= QObject::connect(this,
&iVoiceCom
:: stateCallChangedT,
this,
&iVoiceCom
:: onCallStateChanged, Qt
::QueuedConnection);
qDebug() << "Connection established?" << connected;
const bool connected = QObject::connect(this, &iVoiceCom:: stateCallChangedT,this, &iVoiceCom:: onCallStateChanged, Qt::QueuedConnection);
qDebug() << "Connection established?" << connected;
To copy to clipboard, switch view to plain text mode
In the main I am defining the variables to be passed from
qRegisterMetaType<pjsua_call_id>("pjsua_call_id");
qRegisterMetaType<pjsip_event*>("pjsip_event");
qRegisterMetaType<pjsua_call_id>("pjsua_call_id");
qRegisterMetaType<pjsip_event*>("pjsip_event");
To copy to clipboard, switch view to plain text mode
Then in this function I run the emit with the 2 varialbes, one int and a pointer:
void iVoiceCom:: on_call_state(pjsua_call_id call_id, pjsip_event *e)
{
//callStateChanged(call_id,e);
emit stateCallChangedT(call_id, e);
}
void iVoiceCom:: on_call_state(pjsua_call_id call_id, pjsip_event *e)
{
//callStateChanged(call_id,e);
emit stateCallChangedT(call_id, e);
}
To copy to clipboard, switch view to plain text mode
The SIGNAL is emited OK and the function below is run, but the "e" pointer is passed until a certain point
e->type OK
e->body.tsx_state.type OK
e->type OK
e->body.tsx_state.type OK
To copy to clipboard, switch view to plain text mode
BUT
e->body.tsx_state.src.rdata->msg_info.msg; is LOST and I do not understand why, the back trace from gdb:
e->body.tsx_state.src.rdata->msg_info.msg; is LOST and I do not understand why, the back trace from gdb:
To copy to clipboard, switch view to plain text mode
Program received signal SIGSEGV, Segmentation fault.
0x00000000004226da in iVoiceCom:: onCallStateChanged (this=0x7fffffffc9d0, call_id=0, e=0x7fffc7ffdfe0) at iVoiceCom.cpp:1605
1605 int code = msg->line.status.code;
(gdb) p e->type
$1 = PJSIP_EVENT_TSX_STATE
(gdb) p e->body.tsx_state.type
$2 = PJSIP_EVENT_RX_MSG
(gdb) p e->body.tsx_state.src.rdata->msg_info
$7 = {msg_buf = 0x0, len = 0, msg = 0x0, info = 0x0, cid = 0x0, from = 0x0, to = 0x0, via = 0x0, cseq = 0x0, max_fwd = 0x0, route = 0x0, record_route = 0x0, ctype = 0x0, clen = 0x0, require = 0x0,
supported = 0x0, parse_err = {prev = 0x0, next = 0x0, except_code = 0, line = 0, col = 0, hname = {ptr = 0x0, slen = 0}}}
(gdb)
The slot/function:
void iVoiceCom:: onCallStateChanged(pjsua_call_id call_id, pjsip_event *e)
{
....
if (e->type == PJSIP_EVENT_TSX_STATE)
{
pjsip_msg *msg;
if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)
{
msg = e->body.tsx_state.src.rdata->msg_info.msg;
}
else {
msg = e->body.tsx_state.src.tdata->msg;
}
int code = msg->line.status.code;
...
}
void iVoiceCom:: onCallStateChanged(pjsua_call_id call_id, pjsip_event *e)
{
....
if (e->type == PJSIP_EVENT_TSX_STATE)
{
pjsip_msg *msg;
if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)
{
msg = e->body.tsx_state.src.rdata->msg_info.msg;
}
else {
msg = e->body.tsx_state.src.tdata->msg;
}
int code = msg->line.status.code;
...
}
To copy to clipboard, switch view to plain text mode
Can you please help me to understand what am I doing wrong.
Thank You!
Teo
Bookmarks