Remove bus watch when tearing down pipeline

Guillermo Rodriguez Garcia guille.rodriguez at gmail.com
Wed Sep 2 08:09:53 UTC 2020


Hello,

I have a GStreamer application that can create and tear down multiple pipelines.
For each pipeline that is created I am attaching a bus watch as follows:

GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
gst_bus_add_watch(bus, bus_error_handler, NULL);
gst_object_unref(bus);

When I tear down the pipeline (by setting its state to NULL, and then
calling gst_object_unref(pipeline), do I need to explicitly remove the
bus watch to prevent resource leaks?

I understood that this was not necessary and that the bus watch should
be destroyed automatically, together with the bus. But I am seeing
that the bus watch is explicitly removed in some samples:

https://gstreamer.freedesktop.org/documentation/application-development/basics/bus.html

Can someone clarify?

Thank you,

Guillermo Rodriguez Garcia
guille.rodriguez at gmail.com


More information about the gstreamer-devel mailing list