diff --git a/ChangeLog b/ChangeLog index dac4b31c49..63facb8f30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-06-28 Andy Wingo + * gst/gstobject.c (gst_object_unref, gst_object_ref) + (gst_object_sink): Take gpointer arguments, not GstObject -- + avoids casts. Like GLib. + * gst/gstghostpad.c (gst_proxy_pad_do_activate): Don't proxy activate. diff --git a/docs/gst/tmpl/gstobject.sgml b/docs/gst/tmpl/gstobject.sgml index 521cbc1c82..ab9e4433d6 100644 --- a/docs/gst/tmpl/gstobject.sgml +++ b/docs/gst/tmpl/gstobject.sgml @@ -316,6 +316,7 @@ Acquire a reference to the mutex of this object. @object: the object + @Returns: diff --git a/gst/gstobject.c b/gst/gstobject.c index d0f73c28c7..58b7f8af88 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -255,8 +255,8 @@ gst_object_constructor (GType type, guint n_construct_properties, * * Returns: A pointer to the object */ -GstObject * -gst_object_ref (GstObject * object) +gpointer +gst_object_ref (gpointer object) { g_return_val_if_fail (GST_IS_OBJECT (object), NULL); @@ -274,7 +274,7 @@ gst_object_ref (GstObject * object) #endif #ifdef REFCOUNT_HACK - g_atomic_int_inc (&object->refcount); + g_atomic_int_inc (&((GstObject *) object)->refcount); PATCH_REFCOUNT (object); #else /* FIXME, not MT safe because glib is not MT safe */ @@ -294,22 +294,16 @@ gst_object_ref (GstObject * object) * * The unref method should never be called with the LOCK held since * this might deadlock the dispose function. - * - * Returns: NULL, so that constructs like - * - * object = gst_object_unref (object); - * - * automatically clear the input object pointer. */ -GstObject * -gst_object_unref (GstObject * object) +void +gst_object_unref (gpointer object) { - g_return_val_if_fail (GST_IS_OBJECT (object), NULL); + g_return_if_fail (GST_IS_OBJECT (object)); #ifdef REFCOUNT_HACK - g_return_val_if_fail (GST_OBJECT_REFCOUNT_VALUE (object) > 0, NULL); + g_return_if_fail (GST_OBJECT_REFCOUNT_VALUE (object) > 0); #else - g_return_val_if_fail (((GObject *) object)->ref_count > 0, NULL); + g_return_if_fail (((GObject *) object)->ref_count > 0); #endif #ifdef DEBUG_REFCOUNT @@ -326,7 +320,8 @@ gst_object_unref (GstObject * object) #endif #ifdef REFCOUNT_HACK - if (G_UNLIKELY (g_atomic_int_dec_and_test (&object->refcount))) { + if (G_UNLIKELY (g_atomic_int_dec_and_test (&((GstObject *) object)-> + refcount))) { PATCH_REFCOUNT1 (object); g_object_unref (object); } else { @@ -336,8 +331,6 @@ gst_object_unref (GstObject * object) /* FIXME, not MT safe because glib is not MT safe */ g_object_unref (object); #endif - - return NULL; } /** @@ -352,7 +345,7 @@ gst_object_unref (GstObject * object) * MT safe. This function grabs and releases the object lock. */ void -gst_object_sink (GstObject * object) +gst_object_sink (gpointer object) { g_return_if_fail (GST_IS_OBJECT (object)); diff --git a/gst/gstobject.h b/gst/gstobject.h index b60f83f0b5..fbbd916624 100644 --- a/gst/gstobject.h +++ b/gst/gstobject.h @@ -144,9 +144,9 @@ void gst_object_default_deep_notify (GObject *object, GstObject *ori GParamSpec *pspec, gchar **excluded_props); /* refcounting + life cycle */ -GstObject * gst_object_ref (GstObject *object); -GstObject * gst_object_unref (GstObject *object); -void gst_object_sink (GstObject *object); +gpointer gst_object_ref (gpointer object); +void gst_object_unref (gpointer object); +void gst_object_sink (gpointer object); /* replace object pointer */ void gst_object_replace (GstObject **oldobj, GstObject *newobj);