[reSIProcate] Maybe a bug ? SipMessage::remove() is crashed in DumFeature::process() function
Karlsson
boost.regex at gmail.com
Fri Oct 3 22:42:08 CDT 2008
Hi all, I have write a class which derived from DumFeature, and implemented
the process function:
DumFeature::ProcessingResult MyFeature::process(Message* msg)
{
SipMessage* sipMsg = (SipMessage*)msg;
if (sipMsg)
{
const resip::Data headerName("User-Agent");
resip::Data headerValue("test);
resip::HeaderBase * headerBase =
HeaderBase::getInstance(resip::Headers::getType(headerName.c_str(),headerName.size()));
if (headerBase)
{
if (sipMsg->exists(*headerBase) == true)
{
sipMsg->remove(*headerBase);
}
HeaderFieldValueList * hfvs = new HeaderFieldValueList();
hfvs->push_back(new HeaderFieldValue(headerValue.data(),
headerValue.size()));
sipMsg->setRawHeader(hfvs, Headers::getType(headerName.data(),
headerName.size()));
}
}
postCommand(auto_ptr<Message>(sipMsg));
return DumFeature::FeatureDone;
}
My application is crashed on *sipMsg->remove(*headerBase); I have debug this
function:*
**
void
SipMessage::remove(const HeaderBase& headerType)
{
*delete mHeaders[headerType.getTypeNum()];*
------------------------->when runing to this line, it will be crashed.
mHeaders[headerType.getTypeNum()] = 0;
};
Above code I have using with *MessageDecorator::decorateMessage* function,
it's working fine.
And I try to use *SipMessage* sipMsg = dynamic_cast<SipMessage*>(msg);* to
instead *SipMessage* sipMsg = (SipMessage*)msg;*
but it's failed, the *dynamic_cast* result it 0.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20081004/1edf781c/attachment.htm>
More information about the resiprocate-devel
mailing list