Chromium Code Reviews| Index: talk/app/webrtc/peerconnection.cc |
| diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc |
| index f0db1397aa7941612612ea3be8cb010b0b09c854..566ca619e9c6ffb8b20850616ef27b5b068d260c 100644 |
| --- a/talk/app/webrtc/peerconnection.cc |
| +++ b/talk/app/webrtc/peerconnection.cc |
| @@ -106,6 +106,7 @@ enum { |
| MSG_SET_SESSIONDESCRIPTION_FAILED, |
| MSG_CREATE_SESSIONDESCRIPTION_FAILED, |
| MSG_GETSTATS, |
| + MSG_FREE_DATACHANNEL, |
| }; |
| struct SetSessionDescriptionMsg : public rtc::MessageData { |
| @@ -1313,6 +1314,13 @@ void PeerConnection::OnMessage(rtc::Message* msg) { |
| delete param; |
| break; |
| } |
| + case MSG_FREE_DATACHANNEL: { |
| + auto param = |
| + static_cast<rtc::TypedMessageData<rtc::scoped_refptr<DataChannel>>*>( |
| + msg->pdata); |
| + delete param; |
|
pthatcher1
2015/12/03 19:45:15
Does "delete msg->pdata" not work without the cast
|
| + break; |
| + } |
| default: |
| RTC_DCHECK(false && "Not implemented"); |
| break; |
| @@ -1900,6 +1908,11 @@ void PeerConnection::OnSctpDataChannelClosed(DataChannel* channel) { |
| if (channel->id() >= 0) { |
| sid_allocator_.ReleaseSid(channel->id()); |
| } |
| + // Since this method is triggered by a signal from the DataChannel, |
| + // we can't free it directly here; we need to free it asynchronously. |
| + signaling_thread()->Post( |
| + this, MSG_FREE_DATACHANNEL, |
|
pthatcher1
2015/12/03 19:45:15
If you don't need the type cast, you could just ca
Taylor Brandstetter
2015/12/04 19:27:45
Good point. Done.
|
| + new rtc::TypedMessageData<rtc::scoped_refptr<DataChannel>>(channel)); |
| sctp_data_channels_.erase(it); |
| return; |
| } |