harness: Unset sink_forward_pad before tearing down sink_harness
authorStian Selnes <stian@pexip.com>
Tue, 8 Dec 2015 13:18:21 +0000 (14:18 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 12 Feb 2016 10:17:31 +0000 (10:17 +0000)
Set the sink_forward_pad to NULL before tearing down sink_harness to
avoid that the harness tries to forward events/queries to it while it's
tearing down.

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

libs/gst/check/gstharness.c

index 4590b0d..979d423 100644 (file)
@@ -913,6 +913,7 @@ gst_harness_teardown (GstHarness * h)
     gst_harness_teardown (h->src_harness);
   }
 
+  gst_object_replace ((GstObject **) & priv->sink_forward_pad, NULL);
   if (h->sink_harness) {
     gst_harness_teardown (h->sink_harness);
   }
@@ -946,9 +947,6 @@ gst_harness_teardown (GstHarness * h)
     g_async_queue_unref (priv->sink_event_queue);
   }
 
-  if (priv->sink_forward_pad)
-    gst_object_unref (priv->sink_forward_pad);
-
   gst_object_replace ((GstObject **) & priv->propose_allocator, NULL);
   gst_object_replace ((GstObject **) & priv->allocator, NULL);
   gst_object_replace ((GstObject **) & priv->pool, NULL);
@@ -2235,8 +2233,8 @@ gst_harness_add_sink_harness (GstHarness * h, GstHarness * sink_harness)
   GstHarnessPrivate *priv = h->priv;
 
   if (h->sink_harness) {
+    gst_object_replace ((GstObject **) &priv->sink_forward_pad, NULL);
     gst_harness_teardown (h->sink_harness);
-    gst_object_unref (priv->sink_forward_pad);
   }
   h->sink_harness = sink_harness;
   priv->sink_forward_pad = gst_object_ref (h->sink_harness->srcpad);