[gst-devel] Should element's iterated pads be unref'ed?

4ernov 4ernov at gmail.com
Tue Feb 8 13:26:25 CET 2011


Hello,

I'm using iteration of element's source pads to block them in my
program the following way:

void block_src_pads(GstElement* element, gboolean block)
{
	GstIterator* it = gst_element_iterate_src_pads(element);
	GstIteratorResult result = GST_ITERATOR_OK;
	while (result == GST_ITERATOR_OK)
	{
		gpointer p;
		result = gst_iterator_next(it, &p);
		GstPad* pad = GST_PAD(p);
		gst_pad_set_blocked (pad, block);
		gst_object_unref(pad);
	}
	gst_iterator_free(it);
}

But I often receive this message in the output:

(<unknown>:6683): GStreamer-CRITICAL **:
Trying to dispose object "src", but it still has a parent "mountpoint".
You need to let the parent manage the object instead of unreffing the
object directly.


(<unknown>:6683): GStreamer-CRITICAL **:
Trying to dispose object "src", but it still has a parent "mountpoint".
You need to let the parent manage the object instead of unreffing the
object directly.

The element "mountpoint" is actually valve element and its pads are
("sink", "src", "src") according to gst_iterate_pads().

What could be the problem? Maybe I should't unref pads after usage?
But in all the code snippets I've seen there's unref for every used
pad.




More information about the gstreamer-devel mailing list