Title: [272212] trunk/Source/WebKit
Revision
272212
Author
[email protected]
Date
2021-02-02 09:17:31 -0800 (Tue, 02 Feb 2021)

Log Message

Make sure NetworkRTCProvider stays valid for all NetworkRTCSocketCocoa callbacks
https://bugs.webkit.org/show_bug.cgi?id=221249
<rdar://problem/72671547>

Reviewed by Eric Carlson.

Make the connection callback take a ref of the NetworkRTCProvider.
The ref cycle will break at NetworkConnectionToWebProcess destruction since it will call NetworkRTCProvider::close
which deletes all sockets owning the connection.

* NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm:
(WebKit::NetworkRTCSocketCocoa::NetworkRTCSocketCocoa):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (272211 => 272212)


--- trunk/Source/WebKit/ChangeLog	2021-02-02 17:07:34 UTC (rev 272211)
+++ trunk/Source/WebKit/ChangeLog	2021-02-02 17:17:31 UTC (rev 272212)
@@ -1,3 +1,18 @@
+2021-02-02  Youenn Fablet  <[email protected]>
+
+        Make sure NetworkRTCProvider stays valid for all NetworkRTCSocketCocoa callbacks
+        https://bugs.webkit.org/show_bug.cgi?id=221249
+        <rdar://problem/72671547>
+
+        Reviewed by Eric Carlson.
+
+        Make the connection callback take a ref of the NetworkRTCProvider.
+        The ref cycle will break at NetworkConnectionToWebProcess destruction since it will call NetworkRTCProvider::close
+        which deletes all sockets owning the connection.
+
+        * NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm:
+        (WebKit::NetworkRTCSocketCocoa::NetworkRTCSocketCocoa):
+
 2021-02-02  Per Arne Vollan  <[email protected]>
 
         Unreviewed build fix after 272154.

Modified: trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm (272211 => 272212)


--- trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm	2021-02-02 17:07:34 UTC (rev 272211)
+++ trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm	2021-02-02 17:17:31 UTC (rev 272212)
@@ -182,7 +182,7 @@
     m_nwConnection = adoptNS(nw_connection_create(host.get(), tcpTLS.get()));
 
     nw_connection_set_queue(m_nwConnection.get(), socketQueue());
-    nw_connection_set_state_changed_handler(m_nwConnection.get(), makeBlockPtr([identifier = m_identifier, &rtcProvider, connection = m_connection.copyRef()](nw_connection_state_t state, _Nullable nw_error_t error) {
+    nw_connection_set_state_changed_handler(m_nwConnection.get(), makeBlockPtr([identifier = m_identifier, rtcProvider = makeRef(rtcProvider), connection = m_connection.copyRef()](nw_connection_state_t state, _Nullable nw_error_t error) {
         ASSERT_UNUSED(error, !error);
         switch (state) {
         case nw_connection_state_invalid:
@@ -193,7 +193,7 @@
             connection->send(Messages::LibWebRTCNetwork::SignalConnect(identifier), 0);
             return;
         case nw_connection_state_failed:
-            rtcProvider.callOnRTCNetworkThread([rtcProvider = makeRef(rtcProvider), identifier] {
+            rtcProvider->callOnRTCNetworkThread([rtcProvider, identifier] {
                 rtcProvider->takeSocket(identifier);
             });
             connection->send(Messages::LibWebRTCNetwork::SignalClose(identifier, -1), 0);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to