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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4936>
This commit is contained in:
Jonas Kvinge 2023-06-26 23:09:45 +02:00 committed by Sebastian Dröge
parent c5304751ab
commit fa46905aea

View file

@ -1348,6 +1348,7 @@ setup_next_uri_locked (GstDiscoverer * dc)
if (!ready) {
/* Start timeout */
if (dc->priv->processing)
handle_current_async (dc);
} else {
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
@ -2080,7 +2081,7 @@ start_discovering (GstDiscoverer * dc)
g_source_attach (source, dc->priv->ctx);
goto beach;
}
if (dc->priv->processing)
handle_current_async (dc);
} else {
if (!ready)