stream: release lock even not all transports have been removed
authorAleix Conchillo FlaquƩ <aleix@oblong.com>
Thu, 2 Oct 2014 19:02:48 +0000 (12:02 -0700)
committerWim Taymans <wtaymans@redhat.com>
Tue, 21 Oct 2014 08:08:44 +0000 (10:08 +0200)
We don't want to keep the lock even we return FALSE because not all the
transports have been removed. This could lead into a deadlock.

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

gst/rtsp-server/rtsp-stream.c

index 456ddd9..be66e13 100644 (file)
@@ -1962,7 +1962,8 @@ gst_rtsp_stream_leave_bin (GstRTSPStream * stream, GstBin * bin,
     goto was_not_joined;
 
   /* all transports must be removed by now */
-  g_return_val_if_fail (priv->transports == NULL, FALSE);
+  if (priv->transports != NULL)
+    goto transports_not_removed;
 
   clear_tr_cache (priv);
 
@@ -2072,6 +2073,12 @@ was_not_joined:
     g_mutex_unlock (&priv->lock);
     return TRUE;
   }
+transports_not_removed:
+  {
+    GST_ERROR_OBJECT (stream, "can't leave bin (transports not removed)");
+    g_mutex_unlock (&priv->lock);
+    return FALSE;
+  }
 }
 
 /**