summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2016-11-02 11:00:13 +1100
committerTim-Philipp Müller <tim@centricular.com>2016-11-02 10:14:52 +0000
commit9fc55fa22d20f9460a2c6ea43541e5c517366ec0 (patch)
tree3829d8c09e2f2653e83dad8231c95437502ae825
parent237d7ba4dcd4256b0c78e2bf395c1b3540db08da (diff)
downloadgstreamer-plugins-good-9fc55fa22d20f9460a2c6ea43541e5c517366ec0.tar.gz
splitmuxsink: Fix GObject warnings on shutdown.
Commit 83e718 added a pad template to splitmux request pads, which means that GstElement now releases the pads on dispose, but after having removed all elements in the bin and unlinked them. Make sure we can handle cleanup in that case without throwing assertions. https://bugzilla.gnome.org/show_bug.cgi?id=773784
-rw-r--r--gst/multifile/gstsplitmuxsink.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c
index a7e2ddc94..b5a150995 100644
--- a/gst/multifile/gstsplitmuxsink.c
+++ b/gst/multifile/gstsplitmuxsink.c
@@ -278,11 +278,11 @@ gst_splitmux_sink_dispose (GObject * object)
{
GstSplitMuxSink *splitmux = GST_SPLITMUX_SINK (object);
- G_OBJECT_CLASS (parent_class)->dispose (object);
-
/* Calling parent dispose invalidates all child pointers */
splitmux->sink = splitmux->active_sink = splitmux->muxer = splitmux->mq =
NULL;
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
@@ -1433,7 +1433,7 @@ static void
gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad)
{
GstSplitMuxSink *splitmux = (GstSplitMuxSink *) element;
- GstPad *mqsink, *mqsrc, *muxpad;
+ GstPad *mqsink, *mqsrc = NULL, *muxpad = NULL;
MqStreamCtx *ctx =
(MqStreamCtx *) (g_object_get_qdata ((GObject *) (pad), PAD_CONTEXT));
@@ -1445,8 +1445,11 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad)
GST_INFO_OBJECT (pad, "releasing request pad");
mqsink = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
- mqsrc = mq_sink_to_src (splitmux->mq, mqsink);
- muxpad = gst_pad_get_peer (mqsrc);
+ /* The ghostpad target might have disappeared during pipeline destruct */
+ if (mqsink)
+ mqsrc = mq_sink_to_src (splitmux->mq, mqsink);
+ if (mqsrc)
+ muxpad = gst_pad_get_peer (mqsrc);
/* Remove the context from our consideration */
splitmux->contexts = g_list_remove (splitmux->contexts, ctx);
@@ -1463,14 +1466,19 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad)
splitmux->reference_ctx = NULL;
/* Release and free the mq input */
- gst_element_release_request_pad (splitmux->mq, mqsink);
+ if (mqsink) {
+ gst_element_release_request_pad (splitmux->mq, mqsink);
+ gst_object_unref (mqsink);
+ }
/* Release and free the muxer input */
- gst_element_release_request_pad (splitmux->muxer, muxpad);
+ if (muxpad) {
+ gst_element_release_request_pad (splitmux->muxer, muxpad);
+ gst_object_unref (muxpad);
+ }
- gst_object_unref (mqsink);
- gst_object_unref (mqsrc);
- gst_object_unref (muxpad);
+ if (mqsrc)
+ gst_object_unref (mqsrc);
if (GST_PAD_PAD_TEMPLATE (pad) &&
g_str_equal (GST_PAD_TEMPLATE_NAME_TEMPLATE (GST_PAD_PAD_TEMPLATE (pad)),