[gst-cvs] gnonlin: gnlsource: Unref only pads that (1) exist and (2) are ours.

Edward Hervey bilboed at kemper.freedesktop.org
Mon Feb 23 09:31:05 PST 2009


Module: gnonlin
Branch: master
Commit: 1bbb55cb7bc602afb129a508edc9c251ff2a716c
URL:    http://cgit.freedesktop.org/gstreamer/gnonlin/commit/?id=1bbb55cb7bc602afb129a508edc9c251ff2a716c

Author: Edward Hervey <bilboed at bilboed.com>
Date:   Mon Feb 23 18:30:16 2009 +0100

gnlsource: Unref only pads that (1) exist and (2) are ours.

---

 gnl/gnlsource.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/gnl/gnlsource.c b/gnl/gnlsource.c
index 66d6319..8c86a6d 100644
--- a/gnl/gnlsource.c
+++ b/gnl/gnlsource.c
@@ -256,11 +256,10 @@ element_pad_removed_cb (GstElement * element, GstPad * pad, GnlSource * source)
       gnl_object_remove_ghost_pad ((GnlObject *) source,
           source->priv->ghostpad);
       source->priv->ghostpad = NULL;
+      gst_object_unref (target);
     } else {
       GST_DEBUG_OBJECT (source, "The removed pad wasn't our ghostpad target");
     }
-
-    gst_object_unref (target);
   }
 }
 
@@ -563,13 +562,15 @@ gnl_source_change_state (GstElement * element, GstStateChange transition)
         GstPad *target =
             gst_ghost_pad_get_target ((GstGhostPad *) source->priv->ghostpad);
 
-        gst_pad_set_blocked_async (target, FALSE,
-            (GstPadBlockCallback) pad_blocked_cb, source);
+        if (target) {
+          gst_pad_set_blocked_async (target, FALSE,
+              (GstPadBlockCallback) pad_blocked_cb, source);
+          gst_object_unref (target);
+        }
         gnl_object_remove_ghost_pad ((GnlObject *) source,
             source->priv->ghostpad);
         source->priv->ghostpad = NULL;
         source->priv->ghostedpad = NULL;
-        gst_object_unref (target);
       }
     default:
       break;





More information about the Gstreamer-commits mailing list