multiqueue: Add another check for the flushing flag after taking the lock
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 8 Apr 2011 07:07:59 +0000 (09:07 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 8 Apr 2011 07:15:56 +0000 (09:15 +0200)
This prevents another potential deadlock when flushing the pad
at exactly the right time.

plugins/elements/gstmultiqueue.c

index f043daa..6b1c240 100644 (file)
@@ -1115,6 +1115,13 @@ gst_multi_queue_loop (GstPad * pad)
 
     GST_MULTI_QUEUE_MUTEX_LOCK (mq);
 
+    /* Check again if we're flushing after the lock is taken,
+     * the flush flag might have been changed in the meantime */
+    if (sq->flushing) {
+      GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
+      goto out_flushing;
+    }
+
     /* Update the nextid so other threads know when to wake us up */
     sq->nextid = newid;