pad: Keep an extra ref of the pad when calling an IDLE probe immediately

The callback might destroy the pad.
This commit is contained in:
Sebastian Dröge 2013-12-30 19:03:22 +01:00
parent 0324358ebc
commit d04c8b6d2e

View file

@ -1288,6 +1288,9 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
GstPadProbeInfo info = { GST_PAD_PROBE_TYPE_IDLE, res, }; GstPadProbeInfo info = { GST_PAD_PROBE_TYPE_IDLE, res, };
GstPadProbeReturn ret; GstPadProbeReturn ret;
/* Keep another ref, the callback could destroy the pad */
gst_object_ref (pad);
/* the pad is idle now, we can signal the idle callback now */ /* the pad is idle now, we can signal the idle callback now */
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"pad is idle, trigger idle callback"); "pad is idle, trigger idle callback");
@ -1317,6 +1320,8 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
break; break;
} }
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
gst_object_unref (pad);
} }
} else { } else {
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);