From 06dd8839f4c9e8924221834a6125ef47744c86ed Mon Sep 17 00:00:00 2001 From: Duncan Palmer Date: Tue, 4 Feb 2014 12:52:25 +0100 Subject: [PATCH] uridownloader: Fix race condition between EOS handling and downloading a range https://bugzilla.gnome.org/show_bug.cgi?id=723134 --- gst-libs/gst/uridownloader/gsturidownloader.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/uridownloader/gsturidownloader.c b/gst-libs/gst/uridownloader/gsturidownloader.c index 3c6dbc9e24..afd4c3e3ae 100644 --- a/gst-libs/gst/uridownloader/gsturidownloader.c +++ b/gst-libs/gst/uridownloader/gsturidownloader.c @@ -210,6 +210,7 @@ gst_uri_downloader_bus_handler (GstBus * bus, GST_DEBUG_OBJECT (downloader, "Stopping download"); g_object_unref (downloader->priv->download); downloader->priv->download = NULL; + downloader->priv->cancelled = TRUE; g_cond_signal (&downloader->priv->cond); } GST_OBJECT_UNLOCK (downloader); @@ -409,7 +410,8 @@ gst_uri_downloader_fetch_uri_with_range (GstUriDownloader * downloader, * - the download was canceled */ GST_DEBUG_OBJECT (downloader, "Waiting to fetch the URI %s", uri); - g_cond_wait (&downloader->priv->cond, GST_OBJECT_GET_LOCK (downloader)); + while (!downloader->priv->cancelled && !downloader->priv->download->completed) + g_cond_wait (&downloader->priv->cond, GST_OBJECT_GET_LOCK (downloader)); if (downloader->priv->cancelled) { if (downloader->priv->download) {