bus: do not leak messages if there is no async handler

This does not typically happen because "enable-async" property is TRUE
by default. The only place where it is set to FALSE is in GstBin where a
sync handler is used and always returns GST_BUS_DROP.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6124>
This commit is contained in:
Xavier Claessens 2024-02-15 09:15:50 -05:00 committed by GStreamer Marge Bot
parent 350345150e
commit 57f12dd2fa

View file

@ -366,10 +366,13 @@ gst_bus_post (GstBus * bus, GstMessage * message)
g_clear_pointer (&sync_handler, sync_handler_unref);
/* If this is a bus without async message delivery
* always drop the message */
if (!bus->priv->poll)
/* If this is a bus without async message delivery always drop the message.
* If the sync handler returned GST_BUS_DROP it is responsible of unreffing
* the message, otherwise do it ourself. */
if (!bus->priv->poll && reply != GST_BUS_DROP) {
reply = GST_BUS_DROP;
gst_message_unref (message);
}
/* now see what we should do with the message */
switch (reply) {