From 2ed824baac7e650ed2c922aedc62aedf4ea55ebc Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 20 Sep 2005 10:41:03 +0000 Subject: [PATCH] more leaks plumbed, added more debug-logging Original commit message from CVS: * check/gst-libs/controller.c: (plugin_init), (GST_START_TEST): * libs/gst/controller/gstcontroller.c: (gst_controller_new_valist): more leaks plumbed, added more debug-logging * gst/gstmacros.h: whitespace fix --- ChangeLog | 8 ++++++++ check/gst-libs/controller.c | 6 +++++- gst/gstmacros.h | 2 +- libs/gst/controller/gstcontroller.c | 7 +++++-- tests/check/libs/controller.c | 6 +++++- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f304c90..05687ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-09-20 Stefan Kost + + * check/gst-libs/controller.c: (plugin_init), (GST_START_TEST): + * libs/gst/controller/gstcontroller.c: (gst_controller_new_valist): + more leaks plumbed, added more debug-logging + * gst/gstmacros.h: + whitespace fix + 2005-09-20 Thomas Vander Stichele * gst/gstmessage.c: diff --git a/check/gst-libs/controller.c b/check/gst-libs/controller.c index 74591c8..066f0b7 100644 --- a/check/gst-libs/controller.c +++ b/check/gst-libs/controller.c @@ -339,6 +339,7 @@ GST_START_TEST (controller_new_okay1) ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); g_object_unref (ctrl); gst_object_unref (elem); } @@ -357,6 +358,7 @@ GST_START_TEST (controller_new_okay2) ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "double", NULL); fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); g_object_unref (ctrl); gst_object_unref (elem); } @@ -380,7 +382,7 @@ GST_START_TEST (controller_new_okay3) fail_unless (ctrl2 != NULL, NULL); fail_unless (ctrl1 == ctrl2, NULL); - g_object_unref (ctrl2); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl1)->ref_count); g_object_unref (ctrl1); gst_object_unref (elem); } @@ -408,6 +410,7 @@ GST_START_TEST (controller_param_twice) res = gst_controller_remove_properties (ctrl, "ulong", NULL); fail_unless (!res, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); g_object_unref (ctrl); gst_object_unref (elem); } @@ -472,6 +475,7 @@ GST_START_TEST (controller_interpolate_none) gst_controller_sink_values (ctrl, 2 * GST_SECOND); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); g_object_unref (ctrl); gst_object_unref (elem); } diff --git a/gst/gstmacros.h b/gst/gstmacros.h index c347fc1..337f1ab 100644 --- a/gst/gstmacros.h +++ b/gst/gstmacros.h @@ -29,7 +29,7 @@ G_BEGIN_DECLS #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) # define GST_GNUC_CONSTRUCTOR \ - __attribute__ ((constructor)) + __attribute__ ((constructor)) #else /* !__GNUC__ */ # define GST_GNUC_CONSTRUCTOR #endif /* !__GNUC__ */ diff --git a/libs/gst/controller/gstcontroller.c b/libs/gst/controller/gstcontroller.c index 0dd3eb4..800a06e 100644 --- a/libs/gst/controller/gstcontroller.c +++ b/libs/gst/controller/gstcontroller.c @@ -435,8 +435,9 @@ gst_controller_new_valist (GObject * object, va_list var_args) // store the controller g_object_set_qdata (object, controller_key, self); } else { - // increment ref-count - self = g_object_ref (self); + // increment ref-count (this causes red-count-leaks + //self = g_object_ref (self); + GST_INFO ("returning existing controller"); } self->properties = g_list_prepend (self->properties, prop); } @@ -446,6 +447,8 @@ gst_controller_new_valist (GObject * object, va_list var_args) } va_end (var_args); + if (self) + GST_INFO ("controller->ref_count=%d", G_OBJECT (self)->ref_count); return (self); } diff --git a/tests/check/libs/controller.c b/tests/check/libs/controller.c index 74591c8..066f0b7 100644 --- a/tests/check/libs/controller.c +++ b/tests/check/libs/controller.c @@ -339,6 +339,7 @@ GST_START_TEST (controller_new_okay1) ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); g_object_unref (ctrl); gst_object_unref (elem); } @@ -357,6 +358,7 @@ GST_START_TEST (controller_new_okay2) ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "double", NULL); fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); g_object_unref (ctrl); gst_object_unref (elem); } @@ -380,7 +382,7 @@ GST_START_TEST (controller_new_okay3) fail_unless (ctrl2 != NULL, NULL); fail_unless (ctrl1 == ctrl2, NULL); - g_object_unref (ctrl2); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl1)->ref_count); g_object_unref (ctrl1); gst_object_unref (elem); } @@ -408,6 +410,7 @@ GST_START_TEST (controller_param_twice) res = gst_controller_remove_properties (ctrl, "ulong", NULL); fail_unless (!res, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); g_object_unref (ctrl); gst_object_unref (elem); } @@ -472,6 +475,7 @@ GST_START_TEST (controller_interpolate_none) gst_controller_sink_values (ctrl, 2 * GST_SECOND); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); g_object_unref (ctrl); gst_object_unref (elem); } -- 2.7.4