Chromium Code Reviews| Index: webrtc/p2p/base/turnserver.cc | 
| diff --git a/webrtc/p2p/base/turnserver.cc b/webrtc/p2p/base/turnserver.cc | 
| index 7dd9e19f63d0f9abd5268218d3210d84f01ab33b..25d090c0800edc375aeae4895c31d95fe0d65ecd 100644 | 
| --- a/webrtc/p2p/base/turnserver.cc | 
| +++ b/webrtc/p2p/base/turnserver.cc | 
| @@ -525,10 +525,14 @@ void TurnServer::DestroyInternalSocket(rtc::AsyncPacketSocket* socket) { | 
| InternalSocketMap::iterator iter = server_sockets_.find(socket); | 
| if (iter != server_sockets_.end()) { | 
| rtc::AsyncPacketSocket* socket = iter->first; | 
| - // We must destroy the socket async to avoid invalidating the sigslot | 
| - // callback list iterator inside a sigslot callback. | 
| - rtc::Thread::Current()->Dispose(socket); | 
| server_sockets_.erase(iter); | 
| + // We must destroy the socket async to avoid invalidating the sigslot | 
| + // callback list iterator inside a sigslot callback. (In other words, | 
| + // deleting an object from within a callback from that object). | 
| + pending_delete_sockets_.push_back( | 
| + std::unique_ptr<rtc::AsyncPacketSocket>(socket)); | 
| + invoker_.AsyncInvoke<void>(RTC_FROM_HERE, rtc::Thread::Current(), | 
| + [this] { pending_delete_sockets_.clear(); }); | 
| 
 
pthatcher1
2016/08/23 00:36:55
I think the style guide said not to store lambdas.
 
Taylor Brandstetter
2016/08/23 01:11:20
The Chromium style guide says to never store *capt
 
pthatcher1
2016/08/23 01:15:32
Ah, thanks for correcting my poor memory.
 
Taylor Brandstetter
2016/08/23 23:31:12
I'll just bite the bullet, it's only a few extra l
 
 | 
| } | 
| } |