Bug 827878 - Don't release TransportFlow while DataChannel runnables may still be in use. r=ekr, a=akeybl
authorRandell Jesup <rjesup@jesup.org>
Fri, 11 Jan 2013 10:53:46 -0500
changeset 127191 c5fa1c30a15a519727d03c23c1cc3133ec004d3e
parent 127190 3a05f9a9eb77b4605a5bed867096ebd3bc3d615c
child 127192 d39c44ce7f8b6aec65bc1f70a9a244800bd9de55
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersekr, akeybl
bugs827878
milestone20.0a2
Bug 827878 - Don't release TransportFlow while DataChannel runnables may still be in use. r=ekr, a=akeybl
netwerk/sctp/datachannel/DataChannel.cpp
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -186,18 +186,19 @@ DataChannelConnection::Destroy()
   // nsDOMDataChannel objects have refs to DataChannels that have refs to us
 
   if (mTransportFlow) {
     MOZ_ASSERT(mSTS);
     MOZ_ASSERT(NS_IsMainThread());
     RUN_ON_THREAD(mSTS, WrapRunnable(nsRefPtr<DataChannelConnection>(this),
                                      &DataChannelConnection::disconnect_all),
                   NS_DISPATCH_NORMAL);
-    // safe to do now from Mainthread per ekr
-    mTransportFlow = nullptr;
+    // don't release mTransportFlow until we are destroyed in case
+    // runnables are in flight.  We may well have packets to send as the
+    // SCTP lib may have sent a shutdown.
   }
 }
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(DataChannelConnection,
                               nsITimerCallback)
 
 bool
 DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUsingDtls)