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).
This commit is contained in:
Tim-Philipp Müller 2014-10-30 15:20:18 +00:00
parent 05588c416a
commit 9b82267aef

View file

@ -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;
}