Try to avoid concurency problems in destructor.

git-svn-id: http://yate.null.ro/svn/yate/trunk@613 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-12-20 16:35:34 +00:00
parent 8fb497b230
commit 0b1e364e7d
1 changed files with 9 additions and 1 deletions

View File

@ -136,6 +136,7 @@ public:
inline YRTPSession(YRTPWrapper* wrap)
: m_wrap(wrap), m_resync(false)
{ }
virtual ~YRTPSession();
virtual bool rtpRecvData(bool marker, unsigned int timestamp,
const void* data, int len);
virtual bool rtpRecvEvent(int event, char key, int duration,
@ -232,7 +233,7 @@ YRTPWrapper::~YRTPWrapper()
Debug(DebugAll,"Cleaning up RTP %p",m_rtp);
YRTPSession* tmp = m_rtp;
m_rtp = 0;
delete tmp;
tmp->destruct();
}
if (m_source) {
Debug(&splugin,DebugGoOn,"There is still a RTP source %p [%p]",m_source,this);
@ -431,6 +432,13 @@ void YRTPWrapper::addDirection(RTPSession::Direction direction)
m_rtp->direction(m_dir);
}
YRTPSession::~YRTPSession()
{
// disconnect thread and transport before our virtual methods become invalid
group(0);
transport(0);
}
bool YRTPSession::rtpRecvData(bool marker, unsigned int timestamp, const void* data, int len)
{
YRTPSource* source = m_wrap ? m_wrap->m_source : 0;