ghostpad: use gst_pad_get_peer to acquire a reference to the target pad
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>
Thu, 6 Mar 2014 11:01:40 +0000 (13:01 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 6 Mar 2014 19:46:28 +0000 (20:46 +0100)
This ensures that the lock of the internal pad is held while referencing
it's peer (= the target pad), which ensures that the peer is not
going to be unlinked/destroyed in the meantime.

https://bugzilla.gnome.org/show_bug.cgi?id=725809

gst/gstghostpad.c

index 47e9dce..f6952cb 100644 (file)
@@ -195,9 +195,7 @@ gst_proxy_pad_get_target (GstPad * pad)
   GstPad *target;
 
   GST_OBJECT_LOCK (pad);
-  target = GST_PROXY_PAD_TARGET (pad);
-  if (target)
-    gst_object_ref (target);
+  target = gst_pad_get_peer (GST_PROXY_PAD_INTERNAL (pad));
   GST_OBJECT_UNLOCK (pad);
 
   return target;