Dear All,

I am using connect in order to send a SIGNAL with 2 variables towards a SLOT. The connect looks like this:

Qt Code:
  1. const bool connected = QObject::connect(this, &iVoiceCom:: stateCallChangedT,this, &iVoiceCom:: onCallStateChanged, Qt::QueuedConnection);
  2. 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
Qt Code:
  1. qRegisterMetaType<pjsua_call_id>("pjsua_call_id");
  2. 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:

Qt Code:
  1. void iVoiceCom:: on_call_state(pjsua_call_id call_id, pjsip_event *e)
  2. {
  3. //callStateChanged(call_id,e);
  4. emit stateCallChangedT(call_id, e);
  5. }
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

Qt Code:
  1. e->type OK
  2. e->body.tsx_state.type OK
To copy to clipboard, switch view to plain text mode 

BUT

Qt Code:
  1. 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:
Qt Code:
  1. void iVoiceCom:: onCallStateChanged(pjsua_call_id call_id, pjsip_event *e)
  2. {
  3. ....
  4. if (e->type == PJSIP_EVENT_TSX_STATE)
  5. {
  6. pjsip_msg *msg;
  7.  
  8. if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)
  9. {
  10. msg = e->body.tsx_state.src.rdata->msg_info.msg;
  11. }
  12. else {
  13. msg = e->body.tsx_state.src.tdata->msg;
  14. }
  15.  
  16. int code = msg->line.status.code;
  17. ...
  18. }
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