From: Julien Moutte Date: Mon, 9 Feb 2004 09:11:50 +0000 (+0000) Subject: gst/gstdata.c: Adding a categorized debug on data_ref because data_unref has one... X-Git-Tag: BRANCH-RELEASE-0_7_5-ROOT~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df6a9792435d70d982153e0fc0decfeca0c2110e;p=platform%2Fupstream%2Fgstreamer.git gst/gstdata.c: Adding a categorized debug on data_ref because data_unref has one and i prefer the debug to be symetric. Original commit message from CVS: 2004-02-09 Julien MOUTTE * gst/gstdata.c: (gst_data_ref): Adding a categorized debug on data_ref because data_unref has one and i prefer the debug to be symetric. * gst/gstqueue.c: (gst_queue_locked_flush): Fix a huge memleak. Buffers were refed when added to the queue and unrefed only once when the queue was flushed. Now the flush handler unref the buffers two times : first unref for the ref added when pushing in the queue's tail and second unref to destroy the flushed buffer. --- diff --git a/ChangeLog b/ChangeLog index 420333a..3d75574 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-02-09 Julien MOUTTE + + * gst/gstdata.c: (gst_data_ref): Adding a categorized debug on data_ref + because data_unref has one and i prefer the debug to be symetric. + * gst/gstqueue.c: (gst_queue_locked_flush): Fix a huge memleak. Buffers + were refed when added to the queue and unrefed only once when the queue + was flushed. Now the flush handler unref the buffers two times : first + unref for the ref added when pushing in the queue's tail and second + unref to destroy the flushed buffer. + 2004-02-08 Thomas Vander Stichele * docs/pwg/building-boiler.xml: fix cvs checkout documentation diff --git a/gst/gstdata.c b/gst/gstdata.c index bf1f4ae..3e8de86 100644 --- a/gst/gstdata.c +++ b/gst/gstdata.c @@ -187,6 +187,9 @@ gst_data_ref (GstData *data) g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (GST_DATA_REFCOUNT_VALUE(data) > 0, NULL); + GST_CAT_LOG (GST_CAT_BUFFER, "ref data %p, count before ref is %d", + data, GST_DATA_REFCOUNT_VALUE (data)); + gst_atomic_int_inc (&data->refcount); return data; diff --git a/gst/gstqueue.c b/gst/gstqueue.c index 343a404..b9f5e1c 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -361,6 +361,10 @@ gst_queue_locked_flush (GstQueue *queue) { while (!g_queue_is_empty (queue->queue)) { GstData *data = g_queue_pop_head (queue->queue); + /* First loose the reference we added when putting that data in the queue */ + gst_data_unref (data); + /* Then loose another reference because we are supposed to destroy that + data when flushing */ gst_data_unref (data); } queue->timeval = NULL; diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 343a404..b9f5e1c 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -361,6 +361,10 @@ gst_queue_locked_flush (GstQueue *queue) { while (!g_queue_is_empty (queue->queue)) { GstData *data = g_queue_pop_head (queue->queue); + /* First loose the reference we added when putting that data in the queue */ + gst_data_unref (data); + /* Then loose another reference because we are supposed to destroy that + data when flushing */ gst_data_unref (data); } queue->timeval = NULL;