diff --git a/ChangeLog b/ChangeLog index fa8be70c10..da09d39fae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-02-01 Sebastian Dröge + + reviewed by: Tim-Philipp Müller + + * libs/gst/base/gstcollectpads.c: (gst_collect_pads_finalize), + (unref_data), (gst_collect_pads_add_pad_full): + * libs/gst/base/gstcollectpads.h: + Don't put the previously added destroy notify in the GstCollectData + struct as all it's padding is already used and we don't want to break + ABI. Instead put in the pad's GObject data for now. This should be + cleaned up for 0.11 (#402393). + 2007-02-01 Sebastian Dröge reviewed by: Wim Taymans diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c index f4d91cb672..67534e60d7 100644 --- a/libs/gst/base/gstcollectpads.c +++ b/libs/gst/base/gstcollectpads.c @@ -134,6 +134,15 @@ gst_collect_pads_finalize (GObject * object) collected = pads->abidata.ABI.pad_list; for (; collected; collected = g_slist_next (collected)) { GstCollectData *pdata = (GstCollectData *) collected->data; + GstCollectDataDestroyNotify destroy_notify; + + /* FIXME: Ugly hack as we can't add more fields to GstCollectData */ + destroy_notify = (GstCollectDataDestroyNotify) + g_object_get_data (G_OBJECT (pdata->pad), + "gst-collect-data-destroy-notify"); + + if (destroy_notify) + destroy_notify (pdata); if (pdata->pad) { GST_DEBUG ("finalize pad %s:%s", GST_DEBUG_PAD_NAME (pdata->pad)); @@ -141,9 +150,6 @@ gst_collect_pads_finalize (GObject * object) pdata->pad = NULL; } - if (pdata->abidata.ABI.destroy_notify) - pdata->abidata.ABI.destroy_notify (pdata); - g_free (pdata); } /* Free pads list */ @@ -207,19 +213,27 @@ ref_data (GstCollectData * data) static void unref_data (GstCollectData * data) { + GstCollectDataDestroyNotify destroy_notify; + g_assert (data != NULL); g_assert (data->abidata.ABI.refcount > 0); if (!g_atomic_int_dec_and_test (&(data->abidata.ABI.refcount))) return; + /* FIXME: Ugly hack as we can't add more fields to GstCollectData */ + destroy_notify = (GstCollectDataDestroyNotify) + g_object_get_data (G_OBJECT (data->pad), + "gst-collect-data-destroy-notify"); + + if (destroy_notify) + destroy_notify (data); + g_object_unref (data->pad); if (data->buffer) { gst_buffer_unref (data->buffer); } - if (data->abidata.ABI.destroy_notify) - data->abidata.ABI.destroy_notify (data); g_free (data); } @@ -310,7 +324,10 @@ gst_collect_pads_add_pad_full (GstCollectPads * pads, GstPad * pad, guint size, data->abidata.ABI.new_segment = FALSE; data->abidata.ABI.eos = FALSE; data->abidata.ABI.refcount = 1; - data->abidata.ABI.destroy_notify = destroy_notify; + + /* FIXME: Ugly hack as we can't add more fields to GstCollectData */ + g_object_set_data (G_OBJECT (pad), "gst-collect-data-destroy-notify", + destroy_notify); GST_COLLECT_PADS_PAD_LOCK (pads); GST_OBJECT_LOCK (pad); diff --git a/libs/gst/base/gstcollectpads.h b/libs/gst/base/gstcollectpads.h index 660fc37220..39d9498462 100644 --- a/libs/gst/base/gstcollectpads.h +++ b/libs/gst/base/gstcollectpads.h @@ -75,8 +75,6 @@ struct _GstCollectData gboolean new_segment; gboolean eos; gint refcount; - /* since 0.10.12 */ - GstCollectDataDestroyNotify destroy_notify; } ABI; /* adding + 0 to mark ABI change to be undone later */ gpointer _gst_reserved[GST_PADDING + 0];