Now OPAL crashes while calling SIP_PDU::~SIP_PDU() -> SIP_PDU::SetTransport(NULL).
I see that safeReferenceCount is 0 so it seems like the object was destroyed already.
When I remove last ReadWriteLock/ReadWriteUnlock changes, then everything works as before.
Stack trace:
[Frames below may be incorrect and/or missing]
ptlibd.dll!PWaitAndSignal::PWaitAndSignal(const PSync & sem={...}, bool wait=true) Line 123 C++
ptlibd.dll!PReadWriteMutex::StartNest() Line 2692 C++
ptlibd.dll!PReadWriteMutex::StartWrite() Line 2817 C++
ptlibd.dll!PSafeObject::LockReadWrite() Line 143 C++
opald.dll!SIP_PDU::SetTransport(const PSafePtr<OpalTransport,PSafePtrBase> & transport={...}) Line 1909 C++
opald.dll!SIP_PDU::~SIP_PDU() Line 1903 C++
opald.dll!SIP_PDU::`scalar deleting destructor'(unsigned int) C++
opald.dll!std::allocator<SIP_PDU>::destroy<SIP_PDU>(SIP_PDU * _Ptr=0x0557b058) Line 623 C++
opald.dll!std::allocator_traits<std::allocator<SIP_PDU> >::destroy<SIP_PDU>(std::allocator<SIP_PDU> & _Al={...}, SIP_PDU * _Ptr=0x0557b058) Line 758 C++
opald.dll!std::_Wrap_alloc<std::allocator<SIP_PDU> >::destroy<SIP_PDU>(SIP_PDU * _Ptr=0x0557b058) Line 909 C++
opald.dll!std::deque<SIP_PDU,std::allocator<SIP_PDU> >::pop_front() Line 1464 C++
opald.dll!std::queue<SIP_PDU,std::deque<SIP_PDU,std::allocator<SIP_PDU> > >::pop() Line 161 C++
opald.dll!SIPConnection::OnReceivedACK(SIP_PDU & ack={...}) Line 3122 C++
opald.dll!SIPConnection::OnReceivedPDU(SIP_PDU & pdu={...}) Line 2175 C++
opald.dll!SIP_PDU_Work::Work() Line 2233 C++
Also.. Is it really needed to make
if (m_transport != NULL) {
PTRACE(5, "SIP\tDereferenced transport 0x" << m_transport << " from 0x" << this << ' ' << *this);
m_transport->Dereference();
}
and then
if (m_transport != NULL) {
PTRACE(5, "SIP\tReferenced transport 0x" << m_transport << " from 0x" << this << ' ' << *this);
m_transport->Reference();
}
This is log:
I have checked in a possible fix for this.
Now OPAL crashes while calling SIP_PDU::~SIP_PDU() -> SIP_PDU::SetTransport(NULL).
I see that safeReferenceCount is 0 so it seems like the object was destroyed already.
When I remove last ReadWriteLock/ReadWriteUnlock changes, then everything works as before.
Stack trace:
Also.. Is it really needed to make
if (m_transport != NULL) {
PTRACE(5, "SIP\tDereferenced transport 0x" << m_transport << " from 0x" << this << ' ' << *this);
m_transport->Dereference();
}
and then
if (m_transport != NULL) {
PTRACE(5, "SIP\tReferenced transport 0x" << m_transport << " from 0x" << this << ' ' << *this);
m_transport->Reference();
}
? Code
const_cast<OpalTransportPtr &="">(m_transport) = transport;
references/dereferences transports already.
It is a different reference count to the PSafePtr one. The code is as it should be.
Check in another change so does not try and lock the object as it is deleted, though that should still work, and certainly does do so here.
About the reference count.. OK, I missed this.
I can confirm that OPAL doesn't crash now.