mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
gst/gstobject.c: for 2.6 refcounting, make debug log more correct by printing the actual refcounts at the time of swa...
Original commit message from CVS: * gst/gstobject.c: for 2.6 refcounting, make debug log more correct by printing the actual refcounts at the time of swap (Wim)
This commit is contained in:
parent
8c2deca31b
commit
91e8b0bb91
3 changed files with 31 additions and 27 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-09-29 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* gst/gstobject.c:
|
||||||
|
for 2.6 refcounting, make debug log more correct by printing
|
||||||
|
the actual refcounts at the time of swap (Wim)
|
||||||
|
|
||||||
2005-09-29 Andy Wingo <wingo@pobox.com>
|
2005-09-29 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
* gst/gstbus.c (gst_bus_remove_signal_watch): New function,
|
* gst/gstbus.c (gst_bus_remove_signal_watch): New function,
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 5cd4217979c25fc1fcbb82282e4ad6cbdea9e6cf
|
Subproject commit e6246e87e86c75b2c9c00d0748f0cd2332295eaa
|
|
@ -357,25 +357,25 @@ gst_object_constructor (GType type, guint n_construct_properties,
|
||||||
gpointer
|
gpointer
|
||||||
gst_object_ref (gpointer object)
|
gst_object_ref (gpointer object)
|
||||||
{
|
{
|
||||||
|
#ifdef REFCOUNT_HACK
|
||||||
|
gint old;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
|
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
|
||||||
|
|
||||||
#ifdef DEBUG_REFCOUNT
|
|
||||||
#ifdef REFCOUNT_HACK
|
#ifdef REFCOUNT_HACK
|
||||||
|
old = g_atomic_int_exchange_and_add (&((GstObject *) object)->refcount, 1);
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p ref %d->%d",
|
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p ref %d->%d",
|
||||||
object,
|
object, old, old + 1);
|
||||||
GST_OBJECT_REFCOUNT_VALUE (object),
|
#endif
|
||||||
GST_OBJECT_REFCOUNT_VALUE (object) + 1);
|
PATCH_REFCOUNT (object);
|
||||||
#else
|
#else
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p ref %d->%d",
|
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p ref %d->%d",
|
||||||
object,
|
object,
|
||||||
((GObject *) object)->ref_count, ((GObject *) object)->ref_count + 1);
|
((GObject *) object)->ref_count, ((GObject *) object)->ref_count + 1);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef REFCOUNT_HACK
|
|
||||||
g_atomic_int_inc (&((GstObject *) object)->refcount);
|
|
||||||
PATCH_REFCOUNT (object);
|
|
||||||
#else
|
|
||||||
g_object_ref (object);
|
g_object_ref (object);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -396,36 +396,34 @@ gst_object_ref (gpointer object)
|
||||||
void
|
void
|
||||||
gst_object_unref (gpointer object)
|
gst_object_unref (gpointer object)
|
||||||
{
|
{
|
||||||
|
#ifdef REFCOUNT_HACK
|
||||||
|
gint old;
|
||||||
|
#endif
|
||||||
g_return_if_fail (GST_IS_OBJECT (object));
|
g_return_if_fail (GST_IS_OBJECT (object));
|
||||||
|
|
||||||
#ifdef REFCOUNT_HACK
|
#ifdef REFCOUNT_HACK
|
||||||
g_return_if_fail (GST_OBJECT_REFCOUNT_VALUE (object) > 0);
|
g_return_if_fail (GST_OBJECT_REFCOUNT_VALUE (object) > 0);
|
||||||
#else
|
|
||||||
g_return_if_fail (((GObject *) object)->ref_count > 0);
|
old = g_atomic_int_exchange_and_add (&((GstObject *) object)->refcount, -1);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_REFCOUNT
|
#ifdef DEBUG_REFCOUNT
|
||||||
#ifdef REFCOUNT_HACK
|
|
||||||
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p unref %d->%d",
|
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p unref %d->%d",
|
||||||
object,
|
object, old, old - 1);
|
||||||
GST_OBJECT_REFCOUNT_VALUE (object),
|
|
||||||
GST_OBJECT_REFCOUNT_VALUE (object) - 1);
|
|
||||||
#else
|
|
||||||
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p unref %d->%d",
|
|
||||||
object,
|
|
||||||
((GObject *) object)->ref_count, ((GObject *) object)->ref_count - 1);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
if (G_UNLIKELY (old == 1)) {
|
||||||
|
|
||||||
#ifdef REFCOUNT_HACK
|
|
||||||
if (G_UNLIKELY (g_atomic_int_dec_and_test (&((GstObject *) object)->
|
|
||||||
refcount))) {
|
|
||||||
PATCH_REFCOUNT1 (object);
|
PATCH_REFCOUNT1 (object);
|
||||||
g_object_unref (object);
|
g_object_unref (object);
|
||||||
} else {
|
} else {
|
||||||
PATCH_REFCOUNT (object);
|
PATCH_REFCOUNT (object);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
g_return_if_fail (((GObject *) object)->ref_count > 0);
|
||||||
|
|
||||||
|
#ifdef DEBUG_REFCOUNT
|
||||||
|
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p unref %d->%d",
|
||||||
|
object,
|
||||||
|
((GObject *) object)->ref_count, ((GObject *) object)->ref_count - 1);
|
||||||
|
#endif
|
||||||
g_object_unref (object);
|
g_object_unref (object);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue