Skip to content
Snippets Groups Projects
Commit 23e850dc authored by Sébastien Blin's avatar Sébastien Blin
Browse files

channeledtransport: fix segfault during callback destruction

onDestroy/onRecv should not be called after destruction. Because
ChanneledSIPTransport is managed by PJSIP, we can't pass a weak_ptr to the
callbacks, so just replace the callbacks during the destruction.

Change-Id: Ibc3f2baf8b4cdcfe45652fd14d1acc9d38a07af4
parent d98c5add
Branches
No related tags found
No related merge requests found
......@@ -155,6 +155,10 @@ ChanneledSIPTransport::~ChanneledSIPTransport()
auto base = getTransportBase();
// Here, we reset callbacks in ChannelSocket to avoid to call it after destruction
// ChanneledSIPTransport is managed by pjsip, so we don't have any weak_ptr available
socket_->setOnRecv([](const uint8_t* buf, size_t len){return len;});
socket_->onShutdown([](){});
// Stop low-level transport first
socket_->shutdown();
socket_.reset();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment