gst/gstdata.c: Adding a categorized debug on data_ref because data_unref has one...
authorJulien Moutte <julien@moutte.net>
Mon, 9 Feb 2004 09:11:50 +0000 (09:11 +0000)
committerJulien Moutte <julien@moutte.net>
Mon, 9 Feb 2004 09:11:50 +0000 (09:11 +0000)
Original commit message from CVS:
2004-02-09  Julien MOUTTE  <julien@moutte.net>

* 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.

ChangeLog
gst/gstdata.c
gst/gstqueue.c
plugins/elements/gstqueue.c

index 420333a..3d75574 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-02-09  Julien MOUTTE  <julien@moutte.net>
+
+       * 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  <thomas at apestaart dot org>
 
        * docs/pwg/building-boiler.xml: fix cvs checkout documentation
index bf1f4ae..3e8de86 100644 (file)
@@ -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;
index 343a404..b9f5e1c 100644 (file)
@@ -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;
index 343a404..b9f5e1c 100644 (file)
@@ -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;