shmsink: fix possible deadlock in _render()/ _allocator_free()
authorMatt Crane <mattcrane@tycoint.com>
Fri, 15 Jan 2016 15:49:12 +0000 (10:49 -0500)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 16 Jan 2016 21:46:28 +0000 (21:46 +0000)
Drop object lock before unrefing memory, otherwise the object
lock might be taken again from the allocator and then things
deadlock.

https://bugzilla.gnome.org/show_bug.cgi?id=760551

sys/shm/gstshmsink.c

index 784acca..13d67bd 100644 (file)
@@ -715,8 +715,8 @@ gst_shm_sink_render (GstBaseSink * bsink, GstBuffer * buf)
     while (self->wait_for_connection && !self->clients) {
       g_cond_wait (&self->cond, GST_OBJECT_GET_LOCK (self));
       if (self->unlock) {
-        gst_memory_unref (memory);
         GST_OBJECT_UNLOCK (self);
+        gst_memory_unref (memory);
         return GST_FLOW_FLUSHING;
       }
     }