From 3127459e226ce16a9b8e2d58f47ccd9e7f026860 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 10 Jul 2005 00:07:51 +0000 Subject: [PATCH] gst/gstelement.c: add debug Original commit message from CVS: * gst/gstelement.c: (gst_element_get_bus): add debug * tools/gst-launch.c: (check_intr), (event_loop): fix bus leaks --- ChangeLog | 7 +++++++ check/gst/gstbin.c | 1 + gst/gstelement.c | 2 ++ tests/check/gst/gstbin.c | 1 + tools/gst-launch.c | 8 +++++++- 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 680faf2468..febd7aa41f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-10 Thomas Vander Stichele + + * gst/gstelement.c: (gst_element_get_bus): + add debug + * tools/gst-launch.c: (check_intr), (event_loop): + fix bus leaks + 2005-07-10 Thomas Vander Stichele * gst/gstpad.c: (gst_pad_link_check_compatible_unlocked): diff --git a/check/gst/gstbin.c b/check/gst/gstbin.c index d6c87a1435..ccd3c842de 100644 --- a/check/gst/gstbin.c +++ b/check/gst/gstbin.c @@ -226,6 +226,7 @@ GST_START_TEST (test_message_state_changed_children) pop_messages (bus, 9); + ASSERT_OBJECT_REFCOUNT (bus, "bus", 1); ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); diff --git a/gst/gstelement.c b/gst/gstelement.c index ec8b6c9ed1..b274e51a3e 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -2321,6 +2321,8 @@ gst_element_get_bus (GstElement * element) gst_object_ref (result); GST_UNLOCK (element); + GST_DEBUG_OBJECT (element, "got bus %" GST_PTR_FORMAT, result); + return result; } diff --git a/tests/check/gst/gstbin.c b/tests/check/gst/gstbin.c index d6c87a1435..ccd3c842de 100644 --- a/tests/check/gst/gstbin.c +++ b/tests/check/gst/gstbin.c @@ -226,6 +226,7 @@ GST_START_TEST (test_message_state_changed_children) pop_messages (bus, 9); + ASSERT_OBJECT_REFCOUNT (bus, "bus", 1); ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); diff --git a/tools/gst-launch.c b/tools/gst-launch.c index fbc74d11b0..19fbe5b335 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -296,6 +296,7 @@ check_intr (GstElement * pipeline) gst_element_get_state (pipeline, NULL, NULL, NULL); g_print ("Pipeline paused.\n"); + gst_object_unref (bus); return FALSE; } @@ -365,8 +366,10 @@ event_loop (GstElement * pipeline, gboolean blocking) revent = gst_bus_poll (bus, GST_MESSAGE_ANY, blocking ? -1 : 0); /* if the poll timed out, only when !blocking */ - if (revent == GST_MESSAGE_UNKNOWN) + if (revent == GST_MESSAGE_UNKNOWN) { + gst_object_unref (bus); return FALSE; + } message = gst_bus_pop (bus); g_return_val_if_fail (message != NULL, TRUE); @@ -377,6 +380,7 @@ event_loop (GstElement * pipeline, gboolean blocking) ("GOT EOS from element \"%s\".\n"), GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message)))); gst_message_unref (message); + gst_object_unref (bus); return FALSE; case GST_MESSAGE_TAG: if (tags) { @@ -416,6 +420,7 @@ event_loop (GstElement * pipeline, gboolean blocking) if (gerror) g_error_free (gerror); g_free (debug); + gst_object_unref (bus); return TRUE; } case GST_MESSAGE_STATE_CHANGED:{ @@ -432,6 +437,7 @@ event_loop (GstElement * pipeline, gboolean blocking) GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message)))); /* cut out of the event loop if check_intr set us to PAUSED */ gst_message_unref (message); + gst_object_unref (bus); return FALSE; } default: