Commit 148ac71a authored by Jan Alexander Steffens's avatar Jan Alexander Steffens
Browse files

pad: Keep IDLE probe hook alive during immediate callback

When the probe returns GST_PAD_PROBE_REMOVE and gets called concurrently
from the streaming thread while we're in the callback here, the hook has
already been destroyed by the time we've reacquired the object lock.
Consequently, cleanup_hook gets passed an invalid pointer.

Keep another reference to the hook alive to avoid this situation.

Part-of: <!873>
parent 637b0d8d
Pipeline #387633 waiting for manual action with stages
in 1 minute and 41 seconds
......@@ -1371,8 +1371,10 @@ cleanup_hook (GstPad * pad, GHook * hook)
"cleaning up hook %lu with flags %08x", hook->hook_id, hook->flags);
if (!G_HOOK_IS_VALID (hook))
if (!G_HOOK_IS_VALID (hook)) {
/* We've already destroyed this hook */
type = (hook->flags) >> G_HOOK_FLAG_USER_SHIFT;
......@@ -1492,6 +1494,9 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
gst_object_ref (pad);
/* Ref the hook, it could be destroyed by the callback or concurrently */
g_hook_ref (&pad->probes, hook);
/* the pad is idle now, we can signal the idle callback now */
"pad is idle, trigger idle callback");
......@@ -1523,6 +1528,7 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
GST_DEBUG_OBJECT (pad, "probe returned %d", ret);
g_hook_unref (&pad->probes, hook);
if (pad->priv->idle_running == 0) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment