From: Stefan Sauer Date: Thu, 5 Apr 2012 19:06:14 +0000 (+0200) Subject: controller: add a finalizer for the test controlbindings X-Git-Tag: RELEASE-0.11.90~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fb774577e0b8a7dd37a98e1d444815dcd9b56f9;p=platform%2Fupstream%2Fgstreamer.git controller: add a finalizer for the test controlbindings No idea why valgrind still inists that there are leaks. --- diff --git a/tests/check/gst/gstcontroller.c b/tests/check/gst/gstcontroller.c index c25c92b..1c535e2 100644 --- a/tests/check/gst/gstcontroller.c +++ b/tests/check/gst/gstcontroller.c @@ -323,6 +323,7 @@ struct _GstTestControlBindingClass }; static GType gst_test_control_binding_get_type (void); +static GstControlBindingClass *gst_test_control_binding_parent_class = NULL; static GstControlBinding * gst_test_control_binding_new (GstObject * object, const gchar * property_name, @@ -345,18 +346,38 @@ gst_test_control_binding_get_control_source (GstTestControlBinding * self) return self->cs ? gst_object_ref (self->cs) : NULL; } +static void +gst_test_control_binding_finalize (GObject * obj) +{ + GstTestControlBinding *self = GST_TEST_CONTROL_BINDING (obj); + + gst_object_unref (self->cs); + + G_OBJECT_CLASS (gst_test_control_binding_parent_class)->finalize (obj); +} + +static void +gst_test_control_binding_class_init (gpointer klass, gpointer class_data) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gst_test_control_binding_parent_class = g_type_class_peek_parent (klass); + + gobject_class->finalize = gst_test_control_binding_finalize; +} + static GType gst_test_control_binding_get_type (void) { - static volatile gsize test_countrol_source_type = 0; + static volatile gsize test_countrol_binding_type = 0; - if (g_once_init_enter (&test_countrol_source_type)) { + if (g_once_init_enter (&test_countrol_binding_type)) { GType type; static const GTypeInfo info = { (guint16) sizeof (GstTestControlBindingClass), NULL, // base_init NULL, // base_finalize - NULL, // class_init + gst_test_control_binding_class_init, // class_init NULL, // class_finalize NULL, // class_data (guint16) sizeof (GstTestControlBinding), @@ -367,9 +388,9 @@ gst_test_control_binding_get_type (void) type = g_type_register_static (GST_TYPE_CONTROL_BINDING, "GstTestControlBinding", &info, 0); - g_once_init_leave (&test_countrol_source_type, type); + g_once_init_leave (&test_countrol_binding_type, type); } - return test_countrol_source_type; + return test_countrol_binding_type; }