From 04ed9e8f34d1306b46e385eaf7a8bc9a312ea6bd Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Thu, 20 Jul 2006 20:02:55 +0000 Subject: [PATCH] gst/gstparse.c: Do not hange on recursive uasge of gst_parse_launch() Original commit message from CVS: * gst/gstparse.c: (gst_parse_launch): Do not hange on recursive uasge of gst_parse_launch() --- ChangeLog | 5 +++++ gst/gstparse.c | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf92919289..60bc8d24f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-07-20 Stefan Kost + + * gst/gstparse.c: (gst_parse_launch): + Do not hange on recursive uasge of gst_parse_launch() + 2006-07-20 Tim-Philipp Müller * gst/gsttaglist.c: diff --git a/gst/gstparse.c b/gst/gstparse.c index 0098c6b940..7847952f61 100644 --- a/gst/gstparse.c +++ b/gst/gstparse.c @@ -136,7 +136,7 @@ gst_parse_launchv (const gchar ** argv, GError ** error) GstElement * gst_parse_launch (const gchar * pipeline_description, GError ** error) { - GstElement *element; + GstElement *element = NULL; static GStaticMutex flex_lock = G_STATIC_MUTEX_INIT; g_return_val_if_fail (pipeline_description != NULL, NULL); @@ -145,9 +145,12 @@ gst_parse_launch (const gchar * pipeline_description, GError ** error) pipeline_description); /* the need for the mutex will go away with flex 2.5.6 */ - g_static_mutex_lock (&flex_lock); - element = _gst_parse_launch (pipeline_description, error); - g_static_mutex_unlock (&flex_lock); + if (g_static_mutex_trylock (&flex_lock)) { + element = _gst_parse_launch (pipeline_description, error); + g_static_mutex_unlock (&flex_lock); + } else { + GST_WARNING ("gst_parse_launch() cannot be nested"); + } return element; }