libs/gst/base/gstbasesink.c: Don't hold the object lock when unreffing a buffer becau...
authorWim Taymans <wim.taymans@gmail.com>
Fri, 9 Nov 2007 14:05:02 +0000 (14:05 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 9 Nov 2007 14:05:02 +0000 (14:05 +0000)
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_last_buffer):
Don't hold the object lock when unreffing a buffer because it could
cause a deadlock when the finalize function wants to grab the object
lock too. Fixes #495133.

ChangeLog
libs/gst/base/gstbasesink.c

index 8ab1b94..d0b8c34 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2007-11-09  Wim Taymans  <wim.taymans@gmail.com>
 
+       * libs/gst/base/gstbasesink.c: (gst_base_sink_set_last_buffer):
+       Don't hold the object lock when unreffing a buffer because it could
+       cause a deadlock when the finalize function wants to grab the object
+       lock too. Fixes #495133.
+
+2007-11-09  Wim Taymans  <wim.taymans@gmail.com>
+
        * gst/gstsegment.c: (gst_segment_set_newsegment_full),
        (gst_segment_to_stream_time), (gst_segment_to_running_time):
        Also accumulate time correctly when doing reverse playback. Fixes
index 07d57a3..3986832 100644 (file)
@@ -834,9 +834,18 @@ gst_base_sink_get_last_buffer (GstBaseSink * sink)
 static void
 gst_base_sink_set_last_buffer (GstBaseSink * sink, GstBuffer * buffer)
 {
+  GstBuffer *old;
+
+  if (buffer)
+    gst_buffer_ref (buffer);
+
   GST_OBJECT_LOCK (sink);
-  gst_buffer_replace (&sink->priv->last_buffer, buffer);
+  old = sink->priv->last_buffer;
+  sink->priv->last_buffer = buffer;
   GST_OBJECT_UNLOCK (sink);
+
+  if (old)
+    gst_buffer_unref (old);
 }
 
 /**