dtlstransport: Notify ICE transport property changes
authorPhilippe Normand <philn@igalia.com>
Sat, 12 Feb 2022 10:05:11 +0000 (10:05 +0000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 14 Feb 2022 03:24:26 +0000 (03:24 +0000)
The application might track the underlying ICE transport, so not notifying
changes might lead to use-after-free issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1688>

subprojects/gst-plugins-bad/gst-libs/gst/webrtc/dtlstransport.c

index c401f7f..e3d54a0 100644 (file)
@@ -64,12 +64,19 @@ void
 gst_webrtc_dtls_transport_set_transport (GstWebRTCDTLSTransport * transport,
     GstWebRTCICETransport * ice)
 {
+  gboolean notify = FALSE;
+
   g_return_if_fail (GST_IS_WEBRTC_DTLS_TRANSPORT (transport));
   g_return_if_fail (GST_IS_WEBRTC_ICE_TRANSPORT (ice));
 
   GST_OBJECT_LOCK (transport);
-  gst_object_replace ((GstObject **) & transport->transport, GST_OBJECT (ice));
+  notify =
+      gst_object_replace ((GstObject **) & transport->transport,
+      GST_OBJECT (ice));
   GST_OBJECT_UNLOCK (transport);
+
+  if (notify)
+    g_object_notify (G_OBJECT (transport), "transport");
 }
 
 static void