From fa46905aead3c6eb75417f00b4b2c3c1a0daba51 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Mon, 26 Jun 2023 23:09:45 +0200 Subject: [PATCH] discoverer: Only call handle_current_async if still processing When gst_element_set_state is called in _setup_locked and errors, the callback is already processed before we reach handle_current_async, and the timer is started even though it's finished processing, which results in a NULL pointer crash later in async_timeout_cb. To fix this, we check that it's still processing before calling handle_current_async. Fixes #1683 Part-of: --- .../gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c index 678e1d07c7..1ef00c718e 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c @@ -1348,7 +1348,8 @@ setup_next_uri_locked (GstDiscoverer * dc) if (!ready) { /* Start timeout */ - handle_current_async (dc); + if (dc->priv->processing) + handle_current_async (dc); } else { g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, (GSourceFunc) emit_discovererd_and_next, gst_object_ref (dc), @@ -2080,8 +2081,8 @@ start_discovering (GstDiscoverer * dc) g_source_attach (source, dc->priv->ctx); goto beach; } - - handle_current_async (dc); + if (dc->priv->processing) + handle_current_async (dc); } else { if (!ready) handle_current_sync (dc);