This is a race condition. I am not familiar with the "emit" keyword but
by the looks of it, this keyword triggers an event using another thread
or an event loop. Since you gave the event just a pointer to the string
errorInfo, your event MAY get garbage if errorInfo is already out of
scope or has been deleted in the underlying code of opensipstack before
your event actually gets a time-slice. I suggest you memcpy() the
c_str() to a char * before passing it to your event. Of course, you
need to make sure that your code free()s the string when you are done
with it.
GCC wrote:
> Hello,
>
> When I try to display the information of the object errorInfo, I sometimes get some weird characters. The following is how I did it:
>
> ==================================================
>
> void LoginDialog::Event_OutgoingCallRejected(
> int errorCode,
> const OString & errorInfo
> )
> {
>
> emit outCallRejected( errorInfo.c_str() );
>
> }
>
> And I use the expression:
>
> connect( this, SIGNAL( outCallRejected( const char * ) ), this, SLOT( setCallFail( const char * ) ) );
>
> ===============================================
>
> void LoginDialog::setCallFail( const char *eInfo )
> {
> OStringStream tempEI;
>
> tempEI << "> Error: " << eInfo << "\n";
> m_OverallStatus->textCursor().insertText( tempEI.str().c_str() );
>
> }
>
>
>
> The same problem seems to occur in other pure virtual functions. The screenshot of the problem is here:
>
> http://img249.imageshack.us/img249/8875/weirdpn3.jpg
>
> Can anyone help me fix it?
>
> Regards,
>
> GCC
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> opensipstack-devel mailing list
> ope...@li...
> https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
>
>
>
|