From: Arun Raghavan Date: Mon, 17 Jan 2011 10:00:08 +0000 (+0530) Subject: discoverer: Validate timeouts before processing them X-Git-Tag: RELEASE-0.10.32~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65a298fdeee5b9214f83878a6d757e90d45562cb;p=platform%2Fupstream%2Fgst-plugins-base.git discoverer: Validate timeouts before processing them This avoids a race where the timeout callback is scheduled to run but we get sufficient information to finish discovery before actually getting around to executing the callback. See the documentation of g_source_is_destroyed() for more details. https://bugzilla.gnome.org/show_bug.cgi?id=639730 --- diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index ab32b91..46e2cfb 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -1153,12 +1153,14 @@ discoverer_bus_cb (GstBus * bus, GstMessage * msg, GstDiscoverer * dc) static gboolean async_timeout_cb (GstDiscoverer * dc) { - dc->priv->timeoutid = 0; - GST_DEBUG ("Setting result to TIMEOUT"); - dc->priv->current_info->result = GST_DISCOVERER_TIMEOUT; - dc->priv->processing = FALSE; - discoverer_collect (dc); - discoverer_cleanup (dc); + if (!g_source_is_destroyed (g_main_current_source ())) { + dc->priv->timeoutid = 0; + GST_DEBUG ("Setting result to TIMEOUT"); + dc->priv->current_info->result = GST_DISCOVERER_TIMEOUT; + dc->priv->processing = FALSE; + discoverer_collect (dc); + discoverer_cleanup (dc); + } return FALSE; }