Bug 1315248 - Hold on to references for WrapRunnable in UDPSocketParent. r=jesup, a=gchang
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Thu, 23 Feb 2017 08:55:35 -0500
changeset 378663 08c8172374801689c5793ff23a3b5a5ce2a81c2e
parent 378662 b81da358001ae8b3510d759558efdad9cf011d76
child 378664 7cd0cae1045d7be5b79a714e8ce41d6d2dfd6b4d
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, gchang
bugs1315248
milestone53.0a2
Bug 1315248 - Hold on to references for WrapRunnable in UDPSocketParent. r=jesup, a=gchang MozReview-Commit-ID: CA14BbXYtcj
dom/network/UDPSocketParent.cpp
--- a/dom/network/UDPSocketParent.cpp
+++ b/dom/network/UDPSocketParent.cpp
@@ -238,17 +238,17 @@ static void CheckSTSThread()
 // Proxy the Connect() request to the STS thread, since it may block and
 // should be done there.
 mozilla::ipc::IPCResult
 UDPSocketParent::RecvConnect(const UDPAddressInfo& aAddressInfo)
 {
   nsCOMPtr<nsIEventTarget> thread(NS_GetCurrentThread());
   Unused <<
     NS_WARN_IF(NS_FAILED(GetSTSThread()->Dispatch(WrapRunnable(
-                                                    this,
+                                                    RefPtr<UDPSocketParent>(this),
                                                     &UDPSocketParent::DoConnect,
                                                     mSocket,
                                                     thread,
                                                     aAddressInfo),
                                                   NS_DISPATCH_NORMAL)));
   return IPC_OK();
 }
 
@@ -260,17 +260,17 @@ UDPSocketParent::DoSendConnectResponse(c
 }
 
 void
 UDPSocketParent::SendConnectResponse(nsIEventTarget *aThread,
                                      const UDPAddressInfo& aAddressInfo)
 {
   Unused <<
     NS_WARN_IF(NS_FAILED(aThread->Dispatch(WrapRunnable(
-                                             this,
+                                             RefPtr<UDPSocketParent>(this),
                                              &UDPSocketParent::DoSendConnectResponse,
                                              aAddressInfo),
                                            NS_DISPATCH_NORMAL)));
 }
 
 // Runs on STS thread
 void
 UDPSocketParent::DoConnect(nsCOMPtr<nsIUDPSocket>& aSocket,
@@ -579,16 +579,16 @@ UDPSocketParent::FireInternalError(uint3
 
 void
 UDPSocketParent::SendInternalError(nsIEventTarget *aThread,
                                    uint32_t aLineNo)
 {
   UDPSOCKET_LOG(("SendInternalError: %u", aLineNo));
   Unused <<
     NS_WARN_IF(NS_FAILED(aThread->Dispatch(WrapRunnable(
-                                             this,
+                                             RefPtr<UDPSocketParent>(this),
                                              &UDPSocketParent::FireInternalError,
                                              aLineNo),
                                            NS_DISPATCH_NORMAL)));
 }
 
 } // namespace dom
 } // namespace mozilla