From 9b82267aef7c34d8a5e506abda2e2b2c512807a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 30 Oct 2014 15:20:18 +0000 Subject: [PATCH] smart-adder: fix crash in unit test Unref pads_info hash table in dispose instead of finalize, i.e. before gst_bin_dispose runs and destroys pads_info->bin (to which the pads_info does not hold a ref). --- ges/ges-smart-adder.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ges/ges-smart-adder.c b/ges/ges-smart-adder.c index 3b1f2a79a1..a1bea12697 100644 --- a/ges/ges-smart-adder.c +++ b/ges/ges-smart-adder.c @@ -147,13 +147,25 @@ _release_pad (GstElement * element, GstPad * pad) /**************************************************** * GObject vmethods * ****************************************************/ +static void +ges_smart_adder_dispose (GObject * object) +{ + GESSmartAdder *self = GES_SMART_ADDER (object); + + if (self->pads_infos) { + g_hash_table_unref (self->pads_infos); + self->pads_infos = NULL; + } + + G_OBJECT_CLASS (ges_smart_adder_parent_class)->dispose (object); +} + static void ges_smart_adder_finalize (GObject * object) { GESSmartAdder *self = GES_SMART_ADDER (object); g_mutex_clear (&self->lock); - g_hash_table_unref (self->pads_infos); G_OBJECT_CLASS (ges_smart_adder_parent_class)->finalize (object); } @@ -179,6 +191,7 @@ ges_smart_adder_class_init (GESSmartAdderClass * klass) element_class->request_new_pad = GST_DEBUG_FUNCPTR (_request_new_pad); element_class->release_pad = GST_DEBUG_FUNCPTR (_release_pad); + object_class->dispose = ges_smart_adder_dispose; object_class->finalize = ges_smart_adder_finalize; }