DataConsumer::Close() crash
binxie33 opened this issue · comments
binxie33 commented
In DataConsumer::Close() we should UnregisterObserver first before closing, otherwise it will crash.
/**
* Closes the DataConsumer.
*/
void DataConsumer::Close()
{
MSC_TRACE();
if (this->closed)
return;
this->closed = true;
this->dataChannel->UnregisterObserver(); // here is the fix
this->dataChannel->Close();
this->privateListener->OnClose(this);
}
José Luis Millán commented
does it actually crash currently?
José Luis Millán commented
This should not be needed, otherwise we won't get the 'close' state changed from the underlaying datachannel.
More than that, if we get events from the underlaying datachannel after closing it, that would be a but in libwebrtc.